#Top 20 ASP.NET interview questions
Explore tagged Tumblr posts
Text
Top 20 jQuery Interview Questions and Answers for Experienced(Download Free PDF)
1. What's jQuery? Ans: JQuery isn't a programming language but a nicely composed JavaScript code. 2. Why jQuery is necessary? Ans: JQuery is necessary for the next listing: Employed to create browser compatible web applicationsEnhance the Operation of a programExtremely Fast and adaptiveUI associated functions are composed in minimal traces of codes. 3.Whether jQuery HTML work for both HTML and XML documents?Ans: No, jQuery HTML only works for HTML documents not for XML Documents. 4. Which are the approaches used to supply effects? Ans: A Few of the effects approaches are: 5. What's the benefit of utilizing a minimized variant of jQuery? Ans: Performance of web page raises when minimized variant of jQuery is used.min.js document will probably be more than 50 per cent less compared to standard js file. Decline in the file dimensions leaves the webpage quicker. 6. Is jQuery is a JavaScript or JSON library file? Ans: JQuery is reportedly one JavaScript file. 7. Which operating system is much more harmonious with jQuery? Ans: Mac, Windows and Linux are more compatible with the jQuery. 8. How do we include jQuery library at ASP.Net project? Ans: Download the jQuery library out of jQuery.com and add that mention from the asp.net page. 9. Which command provides a variant of jQuery? Ans: The control $.ui. Variant returns jQuery UI variant. 10. In what situations jQuery may be utilized? Ans: JQuery may be utilized in the following situations: 11. What's the difference between locating and kids approaches? Ans: Find method is used to locate all degrees down the DOM tree, but kids find single degree down the DOM tree. 12. What's jQuery connect? Ans: A' jQuery link' is a plugin used to join or bind a function with a different function. Link is used to do purpose from any other purpose or plugin is implemented. 13. The way to use the link? Ans: Connect can be utilized by downloading jQuery link file from jQuery.com and include that file from the HTML file. Utilize $.connect work to link a function to another function. 14. What are the characteristics of jQuery, has been utilized in web applications? Ans: jQuery uses features like Sliding, File uploading and accordian in web applications. 15. What will be the browser associated problems for jQuery? Ans: Browser compatibility of jQuery plugin is a problem and requires a great deal of time to repair it. 16. Whether we must add jQuery document in the Master and Content webpage? Ans: JQuery document ought to be added to the Master page and may use access from the articles page right without needing any reference to it. 17. Which are the fundamental selectors in jQuery? Ans: Following are the fundamental selectors in jQuery: 18. Can we predict C# code behind utilizing jQuery? Ans: Yes, we could predict C# code out of jQuery since it supports. Net program. 19. What's the usage jQuery. Data technique? Ans: JQuery.data methods can be used to connect the information with the DOM nodes along with the objects. This information system creates the jQuery code concise and clear. 20. What's the use of every operate in jQuery? Ans: Each function can be used to iterate each element of an item. It's used to loop DOM components, arrays along with the item properties. Know more
1 note
¡
View note
Link
#ASP.NET Interview Question#ASP.NET questions#ASP.NET#ASP.NET Questions For interview#Best ASP.NET interview Questions#ASP.NET interview Questions For Freshers#ASP.NET interview questions for experienced#ASP.NET mock test questions for freshers#ASP.NET mock test questions for experienced#most common ASP.NET interview questions#Top 20 ASP.NET interview questions#Top 50 ASP.NET interview questions#ASP.NET Interview Questions & Answers#50 ASP.Net Interview Questions & Answers#ASP.NET Interview Questions And Answers#ASP.NET Interview Questions#Essential .NET Interview Questions#Top 20 .NET Interview Questions and Answers#The Best ASP.NET Interview Questions And Answers [UPDATED] 2019#Tips for Hiring and Interviewing ASP.NET Developers#72 ASP.NET Interview Questions and Answers
0 notes
Photo

Top 20 Node.js Interview Questions and Answers
Node.js is a server-side JavaScript environment for developing web applications like as ASP.NET, JSP, Php etc. It is an open-source and cross-platform framework based on Google's V8 JavaScript Engine. It is used to build fast and scalable network applications as well as data-intensive real-time web applications. Node.js Interview Questions
0 notes
Text
300+ TOP MS ACCESS Interview Questions and Answers
MS ACCESS Interview Questions for freshers experienced :-
1. How MS Access is better than MS SQL Server? With a small number of users, MS Access is easy to handle and suited for desktop use Easy compatibility and sharing compare to MS SQL Server SQL server is, usually, used by developers and in a bigger organization MS Access is cheaper than MS SQL MS Access requires less database administration 2. How we can do multi-join query in MS Access? In Access, we can only join two tables, in order to join more tables you require to group the first join together by using parentheses, as if it was a newly derived table. After that, you can join another table to that group. Select * from ( ( Table 1 LEFT JOIN Table 2⌠) LEFT JOIN Table3⌠) LEFT JOIN Table4⌠3. Would you like to easily automate your MS Access database through menu driven selections? This can be accomplished by creating a form with customized buttons that point to macros. An easier way is to use MS Accessâ built in function called âSwitchboard Managerâ. This can be located in Tools/Add-Ins. 4. Explain about managing data tasks? Data can be managed by using the features of Import text wizard and export text wizard. Here you can save the operation for future use. First you should edit the specification name after clicking it you can make changes to the text box. Path can also be changed by clicking and modifying the changes in text box. Changes to the description of the file name can be made by making a change in the text box and then saving the changes to the path, specification name by pressing enter. 5. When I assigned a primary key to my table in Microsoft Access, I was expecting my (11112 to be sorted. Am I using the correct procedure? Some developers occasionally rely on indexes to sort their data, but shouldnât. Thaiâs because an index is an internal Jet operation that relies on internal rules to speed sorting, which is not the same as actually performing the sort. Records are not stored differently or changed. The sort is not performed until an action is being taken against the data like a query. This is not the same as simply opening a table in its Datasheet View. Although an index often appears to sort data, those internal rules often conflict with normal sorting practices and can have unexpected results. Sorting can be accomplished through the use of a query where ascending or descending can he specified against any one of the fields chosen from the table. 6. How do you import data from another access database? The process of importing data from another Access database follows these general steps they are Preparing the document for import operation and make sure that extensions are not in .mde or .accde because in that extension you can import only tables. Source should be closed automatically when the process is completed Make sure that you have permission for read and write. 7. I am using the Switchboard Manager in MS Access. I am getting an error message â[here was an error executing this command. The Switchboard manager in MS Access offers only limited information on errors that occur within the database. Execute the selection directly Prom the database window to get more detailed information on the error. 8. What happens if the both source and destination are named the same? The import operation present in MS Access does not overwrite or modify any of the existing tables or objects. If both the source and destination are the same it makes sure that numbers are appended to the name of the source file. For example a table having a name as info will be renamed as infol. 9. What format should my database be saved in to allow different versions of Microsoft Access to open the database? MS Access is not backwards compatible. To share tables between different versions of MS Access, you can link the tables between two different databases However, only the tables in the converted database would be available. 10 . What is the maximum size of a database that can be opened in Microsoft Access? 1 Gigabyte
MS ACCESS Interview Questions 11. I am designing an Access database form. how can I get my next control in the form to be automatically selected? By default, Access waits until you press Enter before it selects the Next control on your form. However, this is a wasted keystroke you can eliminate by setting each controlâs Auto Tab property to Yes. This Property also requires that you set an input mask. Once the data youâre entering satisfies the input mask, the Auto Tab property Automatically selects the formâs next control We donât recommend you Use this feature unless you can apply it consistently; otherwise youâll just confuse your users, who wonât know when to press Enter. 12. In MS Access the long and short date option does not show 4 digit years. how do I achieve the mm/dd/yyyy format? In the date field properties of the table, form, or properties manually input the format you would like. It is not required to choose one of the date formats in the drop down box. Example would be mm/dd/yyyy. 13. how can I open an MS Access database that has been converted to a current version? MS Access is not backwards compatible. A workaround to share tables between different versions of MS Access would be to link the tables between two different databases. All objects in the database would not be available. 14. Explain about relationships and look up fields? Relationships are imported from the source to destination without any hindrance but once they land in the destination they can never be altered or changed and change of extensions cannot be of much help. Lookup fields: -Make sure that you link tables, links, etc if you want to display look up values and not look up ids. Related table should be linked to the destination field for display of lookup values. 15. How do you create an append query? Append query can be used if you would like to add new rows of data to an already existing table. The process of creating an append query follows these steps they are. Basic step should be to create a select query After selecting the query you need to append the query Destination fields should be selected for each column in the query Records can be appended by using the function to run. 16 . State some of the uses append query? Some of the uses of append query are as follows You will save time by appending data to an existing table rather than manual update. Appending files based on specific criteria is possible. If your destination file doesnât have columns and rows you can add certain columns and rows thus ignoring the rest of them. Append can save time and labor when dealing with large database updation. 17. State some criteria s and their effects Of a database? It is possible to enter one or more criteria in the rows which can affect your database significantly. >=âCallahanâ this returns all the various records from Callahan to the end of the alphabet. Date() This field returns all the data pertaining to the current date. This is used when you want to know all records which contain zero length string This can be useful to know whether your customers have fax numbers or so. 18. Detail about how you can import a sharepoint list? Importing a Sharepoint list to an access database gives you a range of flexible convenient options first a copy is made into the access database after which you can specify the lists which you would like to copy. Also you have an option to copy an entire list or only a specific file. Also import operation creates a table in access which copies the entire fields and records specified into the Access. 19. Explain the steps for this message could not delete from the specified tables? This error is caused by delete query and when the unique property is set to no. Following are the steps which should be taken to solve the problem. Delete query should be opened and if it is not opening then press F4 Clicking the query properties underneath the query designer will give you options. In that options you need to locate unique records property and should set it to yes. These options are present in query property sheet. 20. Explain about creating a report tool by using the report tool and report wizard? Report tool creates a report very fast because it will not ask you for much information for creating your report. it displays the entire field but it may not be the polished data source you are opting for. Report wizard allows you to create a table by giving you options on what to appear and what not to appear You can specify the relations, grouping and sorting between the tables. 21. Explain about Microsoft access? Microsoft access name has been changed to Microsoft office access. This software incorporates relational database management system which combines GUI (graphical user interface) with Microsoft Jet database engine. It can import and use data from Access, SQL, oracle, etc. This software is used to build application software. 22. Explain about the various features present in MS Access? Microsoft access has huge benefits for a programmer and end user. Some of the benefits are Relative compatibility with SQL and VBA. Microsoft SQL server desktop engine is embedded into the Access suite along with Jetdata base engine which can further help you in programming. MS Access allows forms to contain data which is altered as changes are made to the underlying table. It has features which support the creation of all objects in the underlying server. 23. State some of the uses of MS Access? MS Access provides a huge range of functions some of them are It is used by small business, departments of large corporations, and by amateurs to create applications on their desktop for data applications. Access is very useful for small web based database applications hosted on IIS and using ASP.NET pages. It can be used as a RAD for building prototype and Stand alone applications. Access can be used as a frontend while the backend can be a ODI3C compliant product. 24. Fxplain about the protection features present in MS Access? If a programmer doesnât wish to make changes to the document he can lock the document data and its code from further changes by changing the extension of the file system to .MDE. Changes can be made only to the file with an extension MDE. Tools are available in the market which can unlock and decompile the code but some changes to VBA or VB scripts are irreversible. 25. Name at least six file extensions of Microsoft Access? Some of the file extensions present in MS Access are Access blank project template .adn Access database ,accdb Access project .adp Access Workgroup .mdw Protected access database .accde Access workgroup .mdw 26. In MS Access 2013 what are the different ways you can enter data? Different methods you can enter data in MS Access are Datasheet View Form SQL View Import from External Data (XML, Data Services, HTML etc.) 27. How you can import data from other sources into Access database? To import data into Access data-base In the main menu, click on EXTERNAL DATA, in the Import and Link group Choose the type of the file you want to import To know which type of file can be import or link Access database, follow the instruction in the Get External Data wizard 28. State the criteria which a trusted publisher should meet before adding him? The following criteria should be met by the publisher before adding him to the list. The code project should have a digital signature of the publisher A valid digital signature should be in place Valid digital signature should not be expired Digital certificate which comes with digital signature should meet industry standards and specifications. Developer who is holding and signing the code project should be a trusted publisher. 29. how do you add a developer to a trusted publishers list? Whenever a developer is signing into the code project you will have three options they are disable the macro, enable the macro and explicitly trusting the publisher. You can trust the publisher by allowing from the control panel of the windows. Always have an option left to enable or disable the macros because sensitive information regarding your code can be leaked out within fraction of seconds. 30. Mention how you can create a simple query in Access 2013? Open your database Go to -> create tab Click on the query wizard icon Select a query type From the pull-down menu choose the appropriate table Select the field you want in the query results To add information from additional tables, repeat steps 5 and 6 Click on next Choose the type of results that you would like to produce Give your query a title Click on finish 31. What is the size limitation of an Access database? Size limitation does not pertain to number of records in a table within a database. Forms, reports, macros, and modules also contribute to database size, but is rather minimal compared to tables containing records. It is recommended that if large amounts of data will be maintained or constantly deleted and new data imported, put your tables in another database and link the tables back into the main database. The utilities for database compression and repair will nm much more quickly. In Access 2.0 databases the byte size limitation is 1 gigabyte. In general, use the 1gb rule and suggestions here to maintain performance of the database. See also âHow Replication Increases Size of Database.â. 32. what do you mean by queries? Queries are the medium of manipulating the data to display in the form or report. Queries can join tables, update data, delete data, sort, calculate, filter, etc. MS ACCESS Questions and Answers Pdf Download Read the full article
0 notes
Link
List of Top 20 Most Important ASP.NET Interview Question. Difference between Web Site & Web Application,User Control & Custom Control, Client-Side & Server-Side Validations, Round Trip, Global.asax File, Various Page Events & Navigation Controls in ASP.NET.
0 notes
Link
List of Top 20 Most Important ASP.NET Interview Question. Difference between Web Site & Web Application,User Control & Custom Control, Client-Side & Server-Side Validations, Round Trip, Global.asax File, Various Page Events & Navigation Controls in ASP.NET.
0 notes
Link
0 notes
Text
300+ TOP SOAP Interview Questions and Answers
SOAP Interview Questions for freshers experienced :-
1. What is SOAP? SOAP, Simple Object Access Protocol is a communication protocol, a way to structure data before transmitting it, is based on XML standard. It is developed to allow communication between applications of different platforms and programming languages via internet. It can use range of protocols such as HTTP, FTP, SMTP, Post office protocal 3(POP3) to carry documents. Http-Get, Http-Post works with name/value pair which means transferring complex object is not possible with these protocols, whereas SOAP serializes complex structure, such as ASP.NET DataSets, complex arrays, custom types and XML nodes before transmitting and thus allows exchange of complex objects between applications. 2. What is SOAP? Explain its purpose. SOAP is the acronym for Simple Object Access Protocol. XML based messages over a network of computers are exchanged by using SOAP standard, using HTTP. SOAP purpose: A web service needs a combination of XML, HTTP and a protocol which is application-specific. A web service uses XML data for exchanging. The weather service, stock quote service, look up service of postal department are all sending XML messages and receiving an XML reply. This is the pattern that dominates the web services. To perform these web services, SOAP is the reliable protocol. 3. What is the function of SMON? The SMON background process performs all system monitoring functions on the oracle database. Each time oracle is re-started, SMON performs a warm start and makes sure that the transactions that were left incomplete at the last shut down are recovered. SMON performs periodic cleanup of temporary segments that are no longer needed. 4. Give examples where SOAP is used. Remote methods over multiple platforms and technologies are used with HTTP. SOAP is XML based protocol and platform-agnostic. Each application uses different technology. This may cause problems with proxy server and firewalls. SOAP is the solution for this situation. Industries transport the request for finding best route and best cost price. So the application transfers a request to other similar services which uses SOAP. 5. What are the advantages of SOAP? The main advantages of SOAP are given below: SOAP has huge collection of protocols SOAP is an platform and independent. SOAP is an language independent. Most important feature of SOAP is that it has Simple and extensible by nature. 6. Can you explain the role of XML in SOAP? XML use by many large companies due to its open source nature. XML is an standard format than it is accepted by many organization. Their is a wide variety of tools are available on shelves which is use to ease the process of transition to SOAP. Significance of XML is that to reduce the speed and efficiency.Future format of XML is binary XML. 7. How can you explain HTTPS in SOAP? We can say that HTTPS is similar to HTTP But the main difference b/w them is that HTTPS has an additional layer underneath the internet application layer which is use to make encrypted data.HTTPS protocol is much better and widely than other protocols like IOP or DCOM because these procols can filtered by firewalls. HTTP protocol provide us security when we want to transfer secured data by using advocates WS-I method. 8. How you define Transport methods in SOAP? If we wanted to transfer messages from one end to another end using with Internet application layer.Using SOAP we can transport many productsfrom one end to another end.To perform this task without any error we use one of SMTP and HTTP protocols(Used in transfering information). 9. How we can say that SOAP is different from traditional RPC? The main difference b/w SOAP and Traditional RPC are given below: In SOAP we used procedures which has named parameters and order is irrelevant Where as in XML-RPC order is relevant and parameters do not have names. 10. What do you mean by ESB? ESB is stands for Enterprise Service Bus. ESB is standard based which is most important component of Service Oriented Architecture(SOA).Using ESB we can connect applications through service interfaces.
SOAP Interview Questions 11. What is the SOAP? SOAP stands for Simple Object Access Protocol. SOAP is an XML-based protocol for exchanging information between two computers over the internet. It enables you to Remote Procedure Calls (RPC) transported via HTTP. Following are the SOAP characteristics. SOAP is for communication between applications SOAP is a format for sending messages SOAP is designed to communicate via Internet SOAP is platform independent SOAP is language independent SOAP is simple and extensible 12. Where is SOAP used? It is used to exchanges the information between two computers over the internet. For this we used the XML in special format to send and receive the Information. 13. Difference between XML and SOAP? XML is language whereas SOAP is protocol. 14. Difference between JSON and SOAP? JSON is standard to represent human-readable data.  SOAP is a protocol specification for transmitting information and calling web services use XML. 15. What are the rules for using SOAP? 16. What is SOAP Envelope Element? 17. What does SOAP Namespace defines? The namespace defines the Envelope as a SOAP Envelope. If a different namespace is used, the application generates an error and discards the message. 18. What is the SOAP encodings? The envelope specified the encoding for the body.  This is a method for structuring the request that is suggested within the SOAP specification, known as the SOAP serialization. It's worth noting that one of the biggest technical complaints against SOAP is that it mixes a specification for message transport with a specification for message structure. 19. What does SOAP encodingStyle Attribute defines? The encodingStyle attribute is used to define the data types used in the document(s). This attribute may appear on any SOAP element, and applies to the element's contents and all child element(s). 20. What are the Different Transport Protocols? SOAP, REST,  SMTP, raw TCP Socket. 21. What is UML? Unified Modeling Language 22. can we send soap messages with attachments. Yes, We can send photos/Audio/video with soap messages as an attahcment. SOAP messages can be attached with MIME extensions that come in multipart/related. It is used to send messages using the binary data with defined rules. The SOAP message is carried in the body part with the structure that is followed by the message of the SOAP. 23. What is the difference between SOAP and other remote access techniques? SOAP is simple to use and it is non-symetrical whereas DCOM or CORBA is highly popular and usually have complexity in them. It also has the symmetrical nature in it. 24. What are the problems faced by users by using SOAP? There is a problem to use this protocol as firewall is a security mechanism that comes in between. This ock all the ports leaving few like HTTP port 80 and the HTTP port is used by SOAP that bypasses the firewall. It is a serious concern as it can pose difficulties for the users. There are ways like SOAP traffic can be filtered from the firewalls. 25. What is Simple Object Access Protocol (SOAP)? SOAP acts as a medium to provide basic messaging framework. On these basic messaging frameworks abstract layers are built. It transfers messages across the board in different protocols; it also acts as a medium to transmit XML based messages over the network. 26. Give an example about the functioning of SOAP? Consider a real estate database with huge data ranges. If a user wants to search about a particular term, the message with all the required features such as price, availability, place, etc will be returned to the user in an XML formatted document which the user can integrate into third party site for additional performance. 27. Explain about Remote call procedure? Remote call procedure is considered as a very important function in SOAP. In RCP a user (node) sends a request to another node (server) where the information is processes and sent to the user. It immediately sends message across the network. 28. Explain about Transport methods in SOAP? Internet application layer is used to transfer messages from one end to another end. Various products have been transported successfully from one end to another end using SOAP. Both SMTP and HTTP are two successful transport protocols used in transmitting information, but HTTP has gained good ground than HTTP. 29. Explain about HTTPS in SOAP? HTTPS is similar to HTTP but it has an additional layer underneath the internet application layer which makes the data encrypted. This protocol is widely used than IOP or DCOM because those protocols are filtered by firewalls. HTTPS protocol advocates WS-I method to provide security for transmission of secured data. 30. Explain about the role of XML in SOAP? XML is chosen as a standard format because it was already in use by many large companies and immensely due to its open source nature. A wide variety of tools are available on shelves which ease the process of transition to SOAP. XML can significantly reduce the speed and efficiency but binary XML is being considered as a format for future. 31. What is the difference between RPC and Local calls? An important difference between Remote call procedure and local call is that remote call can fail often and this occurs without the knowledge of the user. Local calls are easily handled. Another main difficulty lies with the code writing capability because it is written in a low level language. 32. What are the elements which should be contained in SOAP message? Following elements are contained in the SOAP message. An envelope element which identifies and translates the XML document into a SOAP message. A header element is a must as it should contain header message. A body is required which should contain call and response message. Fault element is required which can communicate about the errors occurred during the process 33. What about the SOAP Envelope element? A SOAP message will have the SOAP element as the root element. SOAP element name space should always have the value of : as that defines the Envelope. 34. What about the actor element? A SOAP message has to travel a very long distance between its client and server but during the process a part of the message may be intended to be deployed to another destination which is made possible by the SOAP elements actor attribute which address the header element to a particular location. 35. What about the SOAP body element? This part of the element will contain the message which is intended for the ultimate delivery point. An element can be described inside the body element as a default namespace which indicates about the error message during the process. SOAP element acts just like a code to be processed during the execution of a certain application. SOAP Questions and Answers Pdf Download Read the full article
0 notes
Text
300+ TOP Web Services Interview Questions and Answers
Web Services Interview Questions for freshers experienced :-
1. What is Web Service? A web service is a kind of software that is accessible on the Internet. It makes use of the XML messaging system and offers an easy to understand, interface for the end users. 2. What is new in this field for past few years? The initiation of XML in this field is the advancement that provides web service a single language to communicate in between the RPCs, web services and their directories. 3. Give me an example of real web service? One example of web services is IBM Web Services browser. You can get it from IBM Alphaworks site. This browser shows various demos related to web services. Basically web services can be used with the help of SOAP, WSDL, and UDDI . All these, provide a plug-and-play interface for using web services such as stock-quote service, a traffic-report service, weather service etc. 4. How you What is web service protocol stack? It is basically set of various protocols that can be used to explore and execute web services. The entire stack has four layers i.e. Service Transport, XML Messaging, Service Description and Service Discovery. 5. Can you What is each of these layers of protocol stack? The Service Transport layer transfer messages between different applications, such as HTTP, SMTP, FTP, and Blocks Extensible Exchange Protocol (BEEP). The XML Messaging layer encodes messages in XML format so that messages can be understood at each end, such as XML-RPC and SOAP. The Service Description layer describes the user interface to a web service, such as WSDL. The Service Discovery layer centralizes services to a common registry and offer simple publish functionality, such as UDDI. 6. What is XML â RPC? It is a protocol that makes use of XML messages to do Remote Procedure Calls. 7. What is SOAP? SOAP is an XML based protocol to transfer between computers. 8. What is WSDL? It means Web Services Description Language. It is basically the service description layer in the web service protocol stock. The Service Description layer describes the user interface to a web service. 9. What kind of security is needed for web services? The security level for web services should be more than that of what we say Secure Socket Layer (SSL). This level of security can be only achieved from Entrust Secure Transaction Platform. Web services need this level of security to ensure reliable transactions and secure confidential information . 10. Do you have any idea about foundation security services? As implies from its name, these services are the foundation or basics of integration, authentication, authorization, digital signatures and encryption processes.
Web Services Interview Questions 11. What is Entrust Identification Service? Entrust Identification Service comes from the Entrust Security Transaction Platform. This platform allows companies to control the identities that are trusted to perform transactions for Web services transactions. 12. What UDDI means? UDDI stands for Universal, Description, Discovery, and Integration. It is the discovery layer in the web services protocol stack. 13. What is Entrust Entitlements Service? This service verifies entities that attempt to access a web service. For Example, the authentication service, the Entitlements Service ensures security in business operations. 14. What is Entrust Privacy Service? As its name implies, it deals with security and confidentiality. This service encrypts data to ensure that only concerned parties can access the data. 15. What do you mean by PKI? It means Public-Key Infrastructure. 16. What tools are used to test a web service? I have used SoapUI for SOAP WS and Firefox poster plugin for RESTFul Services. 17. Differentiate between a SOA and a Web service? SOA is a design and architecture to implement other services. SOA can be easily implemented using various protocols such as HTTP, HTTPS, JMS, SMTP, RMI, IIOP, RPC etc. While Web service, itself is an implemented technology. In fact one can implement SOA using the web service. 18. Discuss various approaches to develop SOAP based web service? We can develop SOAP based web service with two different types of approaches such as contract-first and contract-last. In the first approach, the contract is What isd first and then the classes are derived from the contract while in the later one, the classes are What isd first and then the contract is derived from these classes. 19. If you have to choose one approach, then what will be your choice? In my point of view, the first approach that is the contract-first approach is more feasible as compared to the second one but still it depends on other factors too. 20. Is there any special application required to access web service? No, you don't need to install any special application to access web service. You can access web service from any application that supports XML based object request and response. 21. Can you name few free and commercial implementations for web services? The implementations I know are Apache SOAP, JAX-WS Reference Implementation, JAX-RS Reference Implementation, Metro, Apache CXF, MS.NET and Java 6. 22. Name browser that allows access to web service? JavaScript XmlHttpRequest object is required to access web service via browsers. The browsers that support this object are Internet Explorer, Safari and Mozilla-based browsers like FireFox. 23. What is REST? REST stands for Representational State Transfer. REST itself is not a standard, while it uses various standards such as HTTP, URL, XML/HTML/GIF/JPEG (Resource Representations. and text/xml, text/html, image/gif, image/jpeg, etc (MIME Types). 24. How one can provide API to users? To provide an API to the users, one can easily do this with an "open table". All you need to do is to write open table which is basically an XML schema that point to a web service. 25. Name the various communication channels in web service? Web service is integrated with three protocols such as HTTP/POST, HTTP/GET, and SOAP. It provides three different communication channels to clients. Client can choose any communication method as per requirements. 26. How can you document web service? Web services are contemplated as self-documenting because they provide entire information regarding the available methods and parameters used for XML based standard, known as WSDL. One can also provide more information to explain web services via their own WebService and WebMethod attributes. 27. What are the situations, when we need ASP.NET web services? ASP.NET web services are used when one need to implement three tier architecture in a web service. It allows handy ways to use middle tier components through internet. The main advantage of .NET Web services is that they are capable enough to communicate across firewalls because they use SOAP as transport protocol. 28. What are distributed technologies? The increasing ratio of distributed applications has raised demand for distributed technologies. It allows segmenting of application units and transferring them to different computers on different networks. 29. Differentiate between web services, CORBA and DCOM? Web services transfer/receive messages to/from application respectively, via HTTP protocol. It uses XML to encode data. CORBA and DCOM transfer/receive messages to/from application respectively, via non-standard protocols such as IIOP and RPC. 30. Can you tell few benefits of web services? The biggest advantage of web service is that is supported by wide variety of platforms. Moreover, in near future, web services may spread its boundary and enhance new methods that will provide ease to clients. The enhancement will not affect the clients, even if they offer old methods and parameters. 31. Can you name some standards used in web services? The standards used in web services are WSDL (used to create interface definition), SOAP (used to structure data), HTTP (communication channels), DISCO (used to create discovery documents) and UDDI (used to create business registries). 32. Explain in brief, what DISCO is? DISCO means discovery. It groups the list of interrelated web services. The organization that provides web services, issues a DISCO file on its server and that file contains the links of all the provided web services. This standard is good when client knows the company already. Also it can be used within a local network as well. 33. Explain in brief, what UDDI is? UDDI (Universal Description, Discovery, and Integration. provides consolidated directory for web services on the internet. Clients use UDDI to find web services as per their business needs. It basically hosts the web services from various companies. In order to share web services, you need to publish it in UDDI. 34. Explain the .NET web services supported data types? .Net web services uses XML-based standards to transfer/receive information. Thus, .NET web services can only works with data types known by XML schema standard. Like FileSteam, Eventlog etc. are not recognized by the XML schema standards and hence, not supported in web services. 35. How a .NET web service is tested? ASP.NET uses a test page routinely, when one calls for the URL of .asmx file in any browser. This page shows complete information regarding web services. 36. How a .NET web service is consumed? Since we know that web services are constructed on XML standards. Therefore, clients need to have complete understanding of XML-based messages to interchange messages. Clients can communicate with web services through .NET framework that offers proxy mechanisms. These proxy mechanisms have detailed information regarding data sharing within web services that can be easily used by the clients. 37. Can you name the two Microsoft solutions for distributed applications? The two Microsoft solutions for distributed applications are .NET Web Services and .NET Remoting. 38. Differentiate between .NET Web Services and .NET Remoting? As far as protocol is concerned, .NET Web Service uses HTTP, while, .NET Remoting uses any protocol i.e. TCP/HTTP/SMTP. When it comes to performance, .NET Remoting is comparatively, faster than.NET Web Service. Also, as .NET Web Services are hosted via IIS, therefore, it is far more reliable than the .NET Remoting. 39. Name the components to be published while deploying a Web Service? The components that need to be published during a web service deployment are Web Application Directory, Webservice.asmx File, Webservice.Disco File, Web.Config File and Bin Directory. 40. What are the steps performed by the client to access a web service? First of all a web reference to the web service is created by the client in his application. Then a proxy class is generated. After that an object of the proxy class is created and at last, the web service is accessed via that proxy object. 41. How web services are implemented in .NET? To implement web services in .NET, HTTP handlers are used that interrupt requests to .asmx files. 42. Explain few disadvantages of Response Caching? Response Caching is useless or incompetent when method accepts extensive amount of values because caching means to store lot of information. Also, if the method depends on external source of information, and that are not provided within the parameters then such methods are bypassed. 43. What is the alternate solution to Response Caching? One can use Data Caching (System.Web.Caching.Cach) instead of Response Caching. 44. Brief few drawbacks of using GET and POST methods to communicate with the web service? These methods are less secure and inhibit users to pass structures and objects as arguments. Also, it doesn't allow users to pass ByRef arguments. 45. How can one access a class as a web service? To access a class as a web service, one should inherit the class from the System.Web.Services.WebService class and qualify the class with the WebService attribute. 46. How can one access the web service class method via internet? To access web service class method via internet, one should qualify a method with the WebMethod attribute. 47. How a SOAP message is structured? A SOAP message is consists of SOAP Envelope, SOAP Headers, and SOAP Body. 48. Can you name different kinds of web services? There are two types of web services in total i.e. SOAP based web service and RESTful web service. This question is already mentioned earlier. 49. What's different in RESTful web services? The RESTful web services contains no contract or WSDL file. 50. Give me few reasons to use RESTful web service? The RESTFul web services are simple to implement and test. It supports various data formats such as XML, JSON etc. 51. What is JAVA web services? What are the methods to create web services? Java webservices is developed to build and deploy basic web service on JAVA platform. To create a web services, there are two approaches that are adopted Top-down approach Top-up approach 52. What is JAXP? JAXP is a JAVA API for XML processing that enables application to write, read, manipulate and transform XML data. Similarly, to perform other various function there are other Java API's as well like JAX-RPC, JAXM, JAXR, JAXB, etc. 53. Explain the JAXB binding framework? JAXB binding framework is available in three Java Packages xml.bind: This package What iss abstract classes and interfaces that are used directly with content classes xml.bind.util: This package contains utility classes that may be availed by client applications to manage marshalling, unmarshalling and validation events xml.bind.helper: This helper package gives partial implementations for some of the javax.xml.bind interfaces. These APIs are not to be directly used by applications using JAXB architecture 54. Give a simple example of how XML document can be Marshal and Unmarshal in JAVA framework? Marshalling is the process of converting XML document into Java readable form while UnMarshalling is the reverse process of Marshalling. Let see how Java unmarshals an XML document and then marshals it back JAXBContext jc= JAXBContext.newInstance ("com.acme.foo"); // unmarshal from foo.xml Unmarshaller u = jc.createUnmarshaller (. ; FooObject fooObj= (FooObject)u.unmarshal (new File ("foo.xml". ); // marshal to sytem.out Marshaller m = jc.createMarshaller (); m.marshal (fooObj, System.out); 55. What does Marshaller do if jaxb.encoding property is not declared? By default, the Marshaller will use "UTF-8" if jaxb.encoding property is not declared. 56. Mention what are the types of validation can a JAXB client can perform? There are two types of JAXB client validation that a JAXB can perform Unmarshal Time Validation On-Demand Validation 57. What are the three ways to handle the event encountered during the marshal, unmarshal and validate operations? Using the default event handler Register and Implement a custom event handler Use the ValidationEventCollector utility 58. Explain where does JAXB compiler is located? JAXB schema binding compiler is placed in the /jaxb/bin directory. In this directory, there are two scripts, xjc.sh (Solaris/Linux. and xjc.bat (Windows). 59. In what cases do you need to customize the default binding? In some cases, you are required to customize the default binding like Creating API documentation for the schema derived JAXB packages, classes, methods and constants Giving semantically meaningful customized names for cases that the default XML name-to-Java identifier mapping cannot handle automatically Overriding default binding- like specifying that a model group should be attached to a class rather than a list 60. What is Inline Customization? Customization to JAXB bindings made by means of inline binding declarations in an XML schema file that take the form of elements embedded in schema elements. 61. What is XML signature? XML can be used to sign any arbitrary data whether it is a binary or XML. The data is recognized via URIs in one or more reference elements. It is described in one or more forms, like detached, enveloping or enveloped. 62. What is Stax? Stax stands for Streaming API for XML; it is an API to read and write XML documents, originating from the JAVA programming language. 63. What are the usual XML APIs? The usual XML APIs includes DOM based or Tree based APIs: The whole document is read into memory as a tree structure for random availability by calling application Event based APIs: The application registers to get events as entities are encountered within the source document 64. What is Push parsing and Pull parsing? Pull Parsing: Streaming pull parsing is referred to a programming model in which a client application calls methods on an XML parsing library, when it needed to communicate with an XML infoset- which means the client will only gets XML data when it is asked for Push Parsing: In Push Parsing, the parser pushes parsing events or XML data to the application. In push model, the parser got the hold over the parsing process and the parser calls the implemented handler methods. 65. Explain on which technology does XWS security is based on? List out the options that XWS security provides for securing JAX-RPC applications? XWS security is based on securing web services build on JAX-RPC and on stand-alone application based on SAAJ. For securing JAX-RPC application, options that XWS security provides are XML digital signature XML encryption Username token verification XWS security framework APIs 66. List out the six packages available in XML Digital signature API? Digital signature API is : xml.crypto xml.crypto.dsig xml.crypto.dsig.keyinfo xml.crypto.dsig.spec xml.crypto.dom xml.crypto.dsig.dom 67. What is JAXR? JAXR is the JAVA programming APIs for Java platform application to access and programmatically interact with various kinds of meta-data registries. 68. What does the JAXR architecture consist of? JAXR architecture is consists of a JAXR client and JAXR provider. JAXR client: It is a client program which uses the JAXR API to use a registry through a JAXR provider JAXR provider: It is an implementation of the JAXR API that provide access to a particular registry provider or to a class of registry providers that are built on a common speicifications. 69. What is JAXM messaging models? There are two types of messaging models for JAXM synchronous and asynchronous Synchronous messaging model: In such type of model, client directly communicates with the source. In this, the client will send the request and waits. Asynchronous messaging model: In this model, client directs the message to the messaging provider and returns back. Messaging provider then executes the routing of the message to the end source. 70. What is UDDI, DISCO and WSDL? UDDI: It means Universal Description, Discovery and I It is the directory that is used to publish and discover public web services DISCO: It is commonly known as discovery. It clubs common services together and exposes schemas document of the web services WSDL: It stands for web service description language (WSDL). It is used to describe web services. The description includes URL of web services, properties and methods supported by web services, data type it supports and protocol detail it supports Web Services Questions and Answers Pdf Download Read the full article
0 notes
Text
300+ TOP ASP.NET MVC Interview Questions and Answers
asp.net mvc interview questions for freshers experienced :-
1. What is ASP.NET MVC? ASP.NET MVC is a web application Framework. It is light weight and highly testable Framework. MVC separates application into three components â Model, View and Controller. 2. Can you explain Model, Controller and View in MVC? Model â Itâs a business entity and it is used to represent the application data. Controller â Request sent by the user always scatters through controller and itâs responsibility is to redirect to the specific view using View() method. View â Itâs the presentation layer of MVC. 3. Explain the new features added in version 4 of MVC (MVC4)? Following are features added newly â Asynchronous controller task support. Bundling the java scripts. Segregating the configs for MVC routing, Web API, Bundle etc. Mobile templates Added ASP.NET Web API template for creating REST based services. Asynchronous controller task support. Bundling the java scripts. Segregating the configs for MVC routing, Web API, Bundle etc. 4. Can you explain the page life cycle of MVC? Below are the processed followed in the sequence - App initialization Routing Instantiate and execute controller Locate and invoke controller action Instantiate and render view. 5. What are the advantages of MVC over ASP.NET? Provides a clean separation of concerns among UI (Presentation layer), model (Transfer objects/Domain Objects/Entities) and Business Logic (Controller). Easy to UNIT Test. Improved reusability of model and views. We can have multiple views which can point to the same model and vice versa. Improved structuring of the code. 6. What is Separation of Concerns in ASP.NET MVC? Itâs is the process of breaking the program into various distinct features which overlaps in functionality as little as possible. MVC pattern concerns on separating the content from presentation and data-processing from content. 7. What is Razor View Engine? Razor is the first major update to render HTML in MVC 3. Razor was designed specifically for view engine syntax. Main focus of this would be to simplify and code-focused templating for HTML generation. Below is the sample of using Razor: @model MvcMusicStore.Models.Customer @{ViewBag.Title = âGet Customersâ;} @Model.CustomerName 8. What is the meaning of Unobtrusive JavaScript? This is a general term that conveys a general philosophy, similar to the term REST (Representational State Transfer). Unobtrusive JavaScript doesnât intermix JavaScript code in your page markup. Eg : Instead of using events like onclick and onsubmit, the unobtrusive JavaScript attaches to elements by their ID or class based on the HTML5 data- attributes. 9. What is the use of ViewModel in MVC? ViewModel is a plain class with properties, which is used to bind it to strongly typed view. ViewModel can have the validation rules defined for its properties using data annotations. 10. What you mean by Routing in MVC? Routing is a pattern matching mechanism of incoming requests to the URL patterns which are registered in route table. Class â âUrlRoutingModuleâ is used for the same process.
ASP.NET MVC Interview Questions 11. What are Actions in MVC? Actions are the methods in Controller class which is responsible for returning the view or json data. Action will mainly have return type â âActionResultâ and it will be invoked from method â âInvokeAction()â called by controller. 12. What is Attribute Routing in MVC? ASP.NET Web API supports this type routing. This is introduced in MVC5. In this type of routing, attributes are being used to define the routes. This type of routing gives more control over classic URI Routing. Attribute Routing can be defined at controller level or at Action level like â â Controller Level â Action Level 13. How to enable Attribute Routing? Just add the method â âMapMvcAttributeRoutes()â to enable attribute routing as shown below public static void RegistearRoutes(RouteCollection routes) { routes.IgnoareRoute(â{resource}.axd/{*pathInfo}â); //enabling attribute routing routes.MapMvcAttributeRoutes(); //convention-based routing routes.MapRoute ( name: âDefaultâ, url: â{controller}/{action}/{id}â, defaults: new { controller = âCustomerâ, action = âGetCustomerListâ, id = UrlParameter.Optional } ); } 14. What is JSON Binding? JavaScript Object Notation (JSON) binding support started from MVC3 onwards via the new JsonValueProviderFactory, which allows the action methods to accept and model-bind data in JSON format. This is useful in Ajax scenarios like client templates and data binding that need to post data back to the server. 15. What is Dependency Resolution? Dependency Resolver again has been introduced in MVC3 and it is greatly simplified the use of dependency injection in your applications. This turn to be easier and useful for decoupling the application components and making them easier to test and more configurable. 16. Explain Bundle.Config in MVC4? âBundleConfig.csâ in MVC4 is used to register the bundles by the bundling and minification system. Many bundles are added by default including jQuery libraries like â jquery.validate, Modernizr, and default CSS references. 17. How route table has been created in ASP.NET MVC? Method â âRegisterRoutes()â is used for registering the routes which will be added in âApplication_Start()â method of global.asax file, which is fired when the application is loaded or started. 18. Which are the important namespaces used in MVC? Below are the important namespaces used in MVC - System.Web.Mvc System.Web.Mvc.Ajax System.Web.Mvc.Html System.Web.Mvc.Async 19. What is ViewData? Viewdata contains the key, value pairs as dictionary and this is derived from class â âViewDataDictionaryâ. In action method we are setting the value for viewdata and in view the value will be fetched by typecasting. 20. What is the difference between ViewBag and ViewData in MVC? ViewBag is a wrapper around ViewData, which allows to create dynamic properties. Advantage of viewbag over viewdata will be â In ViewBag no need to typecast the objects as in ViewData. ViewBag will take advantage of dynamic keyword which is introduced in version 4.0. But before using ViewBag we have to keep in mind that ViewBag is slower than ViewData. 21. Explain TempData in MVC? TempData is again a key, value pair as ViewData. This is derived from âTempDataDictionaryâ class. TempData is used when the data is to be used in two consecutive requests, this could be between the actions or between the controllers. This requires typecasting in view. 22. What are HTML Helpers in MVC? HTML Helpers are like controls in traditional web forms. But HTML helpers are more lightweight compared to web controls as it does not hold viewstate and events. HTML Helpers returns the HTML string which can be directly rendered to HTML page. Custom HTML Helpers also can be created by overriding âHtmlHelperâ class. 23. What are AJAX Helpers in MVC? AJAX Helpers are used to create AJAX enabled elements like as Ajax enabled forms and links which performs the request asynchronously and these are extension methods of AJAXHelper class which exists in namespace â System.Web.Mvc. 24. What are the options can be configured in AJAX helpers? Below are the options in AJAX helpers â Url â This is the request URL. Confirm â This is used to specify the message which is to be displayed in confirm box. OnBegin â Javascript method name to be given here and this will be called before the AJAX request. OnComplete â Javascript method name to be given here and this will be called at the end of AJAX request. OnSuccess â Javascript method name to be given here and this will be called when AJAX request is successful. OnFailure â Javascript method name to be given here and this will be called when AJAX request is failed. UpdateTargetId â Target element which is populated from the action returning HTML. 25. What is Layout in MVC? Layout pages are similar to master pages in traditional web forms. This is used to set the common look across multiple pages. In each child page we can find â /p> @{ Layout = â~/Views/Shared/TestLayout1.cshtmlâ; } This indicates child page uses TestLayout page as itâs master page. 26. Explain Sections is MVC? Section are the part of HTML which is to be rendered in layout page. In Layout page we will use the below syntax for rendering the HTML â @RenderSection(âTestSectionâ) And in child pages we are defining these sections as shown below â @section TestSection{
Test Content
} If any child page does not have this section defined then error will be thrown so to avoid that we can render the HTML like this â @RenderSection(âTestSectionâ, required: false) 27. Can you explain RenderBody and RenderPage in MVC? RenderBody is like ContentPlaceHolder in web forms. This will exist in layout page and it will render the child pages/views. Layout page will have only one RenderBody() method. RenderPage also exists in Layout page and multiple RenderPage() can be there in Layout page. 28. What is ViewStart Page in MVC? This page is used to make sure common layout page will be used for multiple views. Code written in this file will be executed first when application is being loaded. 29. Explain the methods used to render the views in MVC? Below are the methods used to render the views from action - View() â To return the view from action. PartialView() â To return the partial view from action. RedirectToAction() â To Redirect to different action which can be in same controller or in different controller. Redirect() â Similar to âResponse.Redirect()â in webforms, used to redirect to specified URL. RedirectToRoute() â Redirect to action from the specified URL but URL in the route table has been matched. 30. What are the sub types of ActionResult? ActionResult is used to represent the action method result. Below are the subtypes of ActionResult â ViewResult PartialViewResult RedirectToRouteResult RedirectResult JavascriptResult JSONResult FileResult HTTPStatusCodeResult 31. What are Non Action methods in MVC? In MVC all public methods have been treated as Actions. So if you are creating a method and if you do not want to use it as an action method then the method has to be decorated with âNonActionâ attribute as shown below â public void TestMethod() { // Method logic } 32. How to change the action name in MVC? âActionNameâ attribute can be used for changing the action name. Below is the sample code snippet to demonstrate more â public ActionResult TestAction() { return View(); } So in the above code snippet âTestActionâ is the original action name and in âActionNameâ attribute, name â âTestActionNewâ is given. So the caller of this action method will use the name âTestActionNewâ to call this action. 33. What are Code Blocks in Views? Unlike code expressions that are evaluated and sent to the response, it is the blocks of code that are executed. This is useful for declaring variables which we may be required to be used later. @{ int x = 123; string y = âaaâ; } 34. What is the âHelperPage.IsAjaxâ Property? The HelperPage.IsAjax property gets a value that indicates whether Ajax is being used during the request of the Web page. 35. How we can call a JavaScript function on the change of a Dropdown List in MVC? Create a JavaScript method: function DrpIndexChanged() { } Invoke the method: x.SelectedProduct, new SelectList(Model.Customers, âValueâ, âTextâ), âPlease Select a Customerâ, new { id = âddlCustomersâ, onchange=â DrpIndexChanged ()â })%> 36. What are Validation Annotations? Data annotations are attributes which can be found in the âSystem.ComponentModel.DataAnnotationsâ namespace. These attributes will be used for server-side validation and client-side validation is also supported. Four attributes â Required, String Length, Regular Expression and Range are used to cover the common validation scenarios. 37. Why to use Html.Partial in MVC? This method is used to render the specified partial view as an HTML string. This method does not depend on any action methods. We can use this like below â @Html.Partial(âTestPartialViewâ) 38. What is Html.RenderPartial? Result of the method â âRenderPartialâ is directly written to the HTML response. This method does not return anything (void). This method also does not depend on action methods. RenderPartial() method calls âWrite()â internally and we have to make sure that âRenderPartialâ method is enclosed in the bracket. Below is the sample code snippet â@{Html.RenderPartial(âTestPartialViewâ); } 39. What is RouteConfig.cs in MVC 4? âRouteConfig.csâ holds the routing configuration for MVC. RouteConfig will be initialized on Application_Start event registered in Global.asax. 40. What are Scaffold templates in MVC? Scaffolding in ASP.NET MVC is used to generate the Controllers,Model and Views for create, read, update, and delete (CRUD) functionality in an application. The scaffolding will be knowing the naming conventions used for models and controllers and views. 41. Explain the types of Scaffoldings. Below are the types of scaffoldings â Empty Create Delete Details Edit List 42. Can a view be shared across multiple controllers? If Yes, How we can do that? Yes, we can share a view across multiple controllers. We can put the view in the âSharedâ folder. When we create a new MVC Project we can see the Layout page will be added in the shared folder, which is because it is used by multiple child pages. 43. What are the components required to create a route in MVC? Name â This is the name of the route. URL Pattern â Placeholders will be given to match the request URL pattern. Defaults âWhen loading the application which controller, action to be loaded along with the parameter. 44. Why to use â{resource}.axd/{*pathInfo}â in routing in MVC? Using this default route â {resource}.axd/{*pathInfo}, we can prevent the requests for the web resources files like â WebResource.axd or ScriptResource.axd from passing to a controller. 45. Can we add constraints to the route? If yes, explain how we can do it? Yes we can add constraints to route in following ways â Using Regular Expressions Using object which implements interface â IRouteConstraint. 46. What are the possible Razor view extensions? Below are the two types of extensions razor view can have â .cshtml â In C# programming language this extension will be used. .vbhtml â In VB programming language this extension will be used. 47. What is PartialView in MVC? PartialView is similar to UserControls in traditional web forms. For re-usability purpose partial views are used. Since itâs been shared with multiple views these are kept in shared folder. Partial Views can be rendered in following ways â Html.Partial() Html.RenderPartial() 48. How we can add the CSS in MVC? Below is the sample code snippet to add css to razor views â 49. Can I add MVC Testcases in Visual Studio Express? No. We cannot add the test cases in Visual Studio Express edition it can be added only in Professional and Ultimate versions of Visual Studio. 50. What is the use .Glimpse in MVC? Glimpse is an open source tool for debugging the routes in MVC. It is the client side debugger. Glimpse has to be turned on by visiting to local url link - http://localhost:portname//glimpse.axd This is a popular and useful tool for debugging which tracks the speed details, url details etc. asp.net mvc questions and answers Pdf Download Read the full article
0 notes
Text
400+ TOP C#.NET Interview Questions and Answers
C#.NET Interview Questions for freshers experienced :-
1. What is C#? C# is an object oriented, type safe and managed language that is compiled by .Net framework to generate Microsoft Intermediate Language. 2. What are the types of comment in C# with examples? Single line Eg: //This is a Single line comment ii. Multiple line (/* */) Eg: /*This is a multiple line comment We are in line 2 Last line of comment*/ iii. XML Comments (///). Eg: /// summary; /// Set error message for multilingual language. /// summary 3. What's The Difference Between The System.array.copyto() And System.array.clone()? The first one performs a deep copy of the array, the second one is shallow. 4. How Can You Sort The Elements Of The Array In Descending Order? By calling Sort() and then Reverse() methods. 5. What's The .net Datatype That Allows The Retrieval Of Data By A Unique Key? HashTable. 6. What's Class Sortedlist Underneath? A sorted HashTable. 7. Will Finally Block Get Executed If The Exception Had Not Occurred? Yes. 8. What's The C# Equivalent Of C++ Catch (....), Which Was A Catch-all Statement For Any Possible Exception? A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}. 9. Can Multiple Catch Blocks Be Executed? No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block. 10. Why Is It A Bad Idea To Throw Your Own Exceptions? Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project.
C#.NET Interview Questions 11. What's A Delegate? A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers. 12. What's A Multicast Delegate? Itâs a delegate that points to and eventually fires off several methods. 13. How's The Dll Hell Problem Solved In .net? Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly. 14. What Are The Ways To Deploy An Assembly? An MSI installer, a CAB archive, and XCOPY command. 15. What's A Satellite Assembly? When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies. 16. What Namespaces Are Necessary To Create A Localized Application? System.Globalization, System.Resources. 17. What's The Difference Between // Comments, /* */ Comments And /// Comments? Single-line, multi-line and XML documentation comments. 18. How Do You Generate Documentation From The C# File Commented Properly With A Command-line Compiler? Compile it with a /doc switch. 19. What's The Difference Between And Xml Documentation Tag? Single line code example and multiple-line code example. 20. Is Xml Case-sensitive? Yes, so and are different elements. 21. What Debugging Tools Come With The .net Sdk? CorDBG â command-line debugger, and DbgCLR â graphic debugger. Visual Studio .NET uses the DbgCLR. To use CorDbg, you must compile the original C# file using the /debug switch. 22. What Does The This Window Show In The Debugger? It points to the object thatâs pointed to by this reference. Objectâs instance data is shown. 23. What Does Assert() Do? In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true. 24. What's The Difference Between The Debug Class And Trace Class? Documentation Looks The Same. Use Debug class for debug builds, use Trace class for both debug and release builds. 25. Why Are There Five Tracing Levels In System.diagnostics.traceswitcher? The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities. 26. Where Is The Output Of Textwritertracelistener Redirected? To the Console or a text file depending on the parameter passed to the constructor. 27. How Do You Debug An Asp.net Web Application? Attach the aspnet_wp.exe process to the DbgClr debugger. 28. What Are Three Test Cases You Should Go Through In Unit Testing? Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly). 29. Can You Change The Value Of A Variable While Debugging A C# Application? Yes, if you are debugging via Visual Studio.NET, just go to Immediate window. 30. Explain The Three Services Model (three-tier Application). Presentation (UI), business (logic and underlying code) and data (from storage or other sources). 31. What Are Advantages And Disadvantages Of Microsoft-provided Data Provider Classes In Ado.net? SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but itâs a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines. 32. What's The Role Of The Datareader Class In Ado.net Connections? It returns a read-only dataset from the data source when the command is executed. 33. What Is The Wildcard Character In Sql? Let's Say You Want To Query Database With Like For All Employees Whose Name Starts With La. The wildcard character is %, the proper query with LIKE would involve âLa%â. 34. Explain Acid Rule Of Thumb For Transactions. Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no âin-betweenâ case where something has been updated and something hasnât), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system crashes right after). 35. What Connections Does Microsoft Sql Server Support? Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server user name and passwords). 36. Which One Is Trusted And Which One Is Untrusted? Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction. 37. Why Would You Use Untrusted Verificaion? Web Services might use it, as well as non-Windows applications. 38. What Does The Parameter Initial Catalog Define Inside Connection String? The database name to connect to. 39. What's The Data Provider Name To Connect To Access Database? Microsoft.Access. 40. What Does Dispose Method Do With The Connection Object? Deletes it from the memory. 41. What Is A Pre-requisite For Connection Pooling? Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings. 42. What Is C#? C# is a programming language designed by Microsoft. It is loosely based on C/C++, and bears a striking similarity to Java. Microsoft describe C# as follows: "C# is a simple, modern, object oriented, and type-safe programming language derived from C and C++. C# (pronounced 'C sharp') is firmly planted in the C and C++ family tree of languages, and will immediately be familiar to C and C++ programmers. C# aims to combine the high productivity of Visual Basic and the raw power of C++." 43. How Do I Develop C# Apps? The (free) .NET SDK contains the C# command-line compiler (csc.exe). Visual Studio has fully integrated support for C# development. On Linux you can use Mono. 44. Does C# Replace C++? There are three options open to the Windows developer from a C++ background: Stick with standard C++. Don't use .NET at all. Use C++ with .NET. Microsoft supply a .NET C++ compiler that produces IL rather than machine code. However to make full use of the .NET environment (e.g. garbage collection), a set of extensions are required to standard C++. In .NET 1.x this extended language is called Managed Extensions for C++. In .NET 2.0 ME C++ has been completely redesigned under the stewardship of Stan Lippman, and renamed C++/CLI. Forget C++ and use C#. Each of these options has merits, depending on the developer and the application. For my own part, I intend to use C# where possible, falling back to C++ only where necessary. ME C++ (soon to be C++/CLI) is very useful for interop between new .NET code and old C++ code - simply write a managed wrapper class using ME C++, then use the managed class from C#. From experience, this works well. 45. Does C# Have Its Own Class Library? Not exactly. The .NET Framework has a comprehensive class library, which C# can make use of. C# does not have its own class library. 46. What Standard Types Does C# Use? C# supports a very similar range of basic types to C++, including int, long, float, double, char, string, arrays, structs and classes. However, don't assume too much. The names may be familiar, but many of the details are different. For example, a long is 64 bits in C#, whereas in C++ the size of a long depends on the platform (typically 32 bits on a 32-bit platform, 64 bits on a 64-bit platform). Also classes and structs are almost the same in C++ - this is not true for C#. Finally, chars and strings in .NET are 16-bit (Unicode/UTF-16), not 8-bit like C++. 47. Is It True That All C# Types Derive From A Common Base Class? Yes and no. All types can be treated as if they derive from object (System.Object), but in order to treat an instance of a value type (e.g. int, float) as object-derived, the instance must be converted to a reference type using a process called 'boxing'. In theory a developer can forget about this and let the run-time worry about when the conversion is necessary, but in reality this implicit conversion can have side-effects that may trip up the unwary. 48. What Are The Fundamental Differences Between Value Types And Reference Types? C# divides types into two categories - value types and reference types. Most of the intrinsic types (e.g. int, char) are value types. Structs are also value types. Reference types include classes, arrays and strings. The basic idea is straightforward - an instance of a value type represents the actual data, whereas an instance of a reference type represents a pointer or reference to the data. The most confusing aspect of this for C++ developers is that C# has predetermined which types are represented as values, and which are represented as references. A C++ developer expects to take responsibility for this decision. For example, in C++ we can do this: int x1 = 3; // x1 is a value on the stack int *x2 = new int(3) // x2 is a pointer to a value on the heap but in C# there is no control: int x1 = 3; // x1 is a value on the stack int x2 = new int(); x2 = 3; // x2 is also a value on the stack! 49. Okay, So An Int Is A Value Type, And A Class Is A Reference Type. How Can Int Be Derived From Object? It isn't, really. When an int is being used as an int, it is a value. However, when it is being used as an object, it is a reference to an integer value (on the managed heap). In other words, when you treat an int as an object, the runtime automatically converts the int value to an object reference. This process is called boxing. The conversion involves copying the int to the heap, and creating an object instance which refers to it. Unboxing is the reverse process - the object is converted back to a value. int x = 3; // new int value 3 on the stack object objx = x; // new int on heap, set to value 3 - still have x=3 on stack int y = (int)objx; // new value 3 on stack, still got x=3 on stack and objx=3 on heap 50. Are C# References The Same As C++ References? Not quite. The basic idea is the same, but one significant difference is that C# references can be null . So you cannot rely on a C# reference pointing to a valid object. In that respect a C# reference is more like a C++ pointer than a C++ reference. If you try to use a null reference, a NullReferenceException is thrown. For example, look at the following method: void displayStringLength( string s ) { Console.WriteLine( "String is length {0}", s.Length ); } The problem with this method is that it will throw a NullReferenceException if called like this: string s = null; displayStringLength( s ); Of course for some situations you may deem a NullReferenceException to be a perfectly acceptable outcome, but in this case it might be better to re-write the method like this: void displayStringLength( string s ) { if( s == null ) Console.WriteLine( "String is null" ); else Console.WriteLine( "String is length {0}", s.Length ); } 51. Structs Are Largely Redundant In C++. Why Does C# Have Them? In C++, a struct and a class are pretty much the same thing. The only difference is the default visibility level (public for structs, private for classes). However, in C# structs and classes are very different. In C#, structs are value types (instances stored directly on the stack, or inline within heap-based objects), whereas classes are reference types (instances stored on the heap, accessed indirectly via a reference). Also structs cannot inherit from structs or classes, though they can implement interfaces. Structs cannot have destructors. A C# struct is much more like a C struct than a C++ struct. 52. Does C# Support Multiple Inheritance (mi)? No, though it does support implementation of multiple interfaces on a single class or struct. 53. Is A C# Interface The Same As A C++ Abstract Class? No, not quite. An abstract class in C++ cannot be instantiated, but it can (and often does) contain implementation code and/or data members. A C# interface cannot contain any implementation code or data members - it is simply a group of method names & signatures. A C# interface is more like a COM interface than a C++ abstract class. 54. Are C# Constructors The Same As C++ Constructors? Very similar, but there are some significant differences. First, C# supports constructor chaining. This means one constructor can call another: class Person { public Person( string name, int age ) { ... } public Person( string name ) : this( name, 0 ) {} public Person() : this( "", 0 ) {} } Another difference is that virtual method calls within a constructor are routed to the most derived implementation - see Can I Call a virtual method from a constructor. Error handling is also somewhat different. If an exception occurs during construction of a C# object, the destuctor (finalizer) will still be called. This is unlike C++ where the destructor is not called if construction is not completed. (Thanks to Jon Jagger for pointing this out.) Finally, C# has static constructors. The static constructor for a class runs before the first instance of the class is created. Also note that (like C++) some C# developers prefer the factory method pattern over constructors. See Brad Wilson's article. 55. Are C# Destructors The Same As C++ Destructors? No. They look the same but they are very different. The C# destructor syntax (with the familiar ~ character) is just syntactic sugar for an override of the System.Object Finalize method. This Finalize method is called by the garbage collector when it determines that an object is no longer referenced, before it frees the memory associated with the object. So far this sounds like a C++ destructor. The difference is that the garbage collector makes no guarantees about when this procedure happens. Indeed, the algorithm employed by the CLR garbage collector means that it may be a long time after the application has finished with the object. This lack of certainty is often termed 'non-deterministic finalization', and it means that C# destructors are not suitable for releasing scarce resources such as database connections, file handles etc. To achieve deterministic destruction, a class must offer a method to be used for the purpose. The standard approach is for the class to implement the IDisposable interface. The user of the object must call the Dispose() method when it has finished with the object. C# offers the 'using' construct to make this easier. 56. If C# Destructors Are So Different To C++ Destructors, Why Did Ms Use The Same Syntax? Presumably they wanted C++ programmers to feel at home. I think they made a mistake. 57. Are All Methods Virtual In C#? No. Like C++, methods are non-virtual by default, but can be marked as virtual. 58. How Do I Declare A Pure Virtual Function In C#? Use the abstract modifier on the method. The class must also be marked as abstract (naturally). Note that abstract methods cannot have an implementation (unlike pure virtual C++ methods). 59. Can I Call A Virtual Method From A Constructor/destructor? Yes, but it's generally not a good idea. The mechanics of object construction in .NET are quite different from C++, and this affects virtual method calls in constructors. C++ constructs objects from base to derived, so when the base constructor is executing the object is effectively a base object, and virtual method calls are routed to the base class implementation. By contrast, in .NET the derived constructor is executed first, which means the object is always a derived object and virtual method calls are always routed to the derived implementation. (Note that the C# compiler inserts a call to the base class constructor at the start of the derived constructor, thus preserving standard OO semantics by creating the illusion that the base constructor is executed first.) The same issue arises when calling virtual methods from C# destructors. A virtual method call in a base destructor will be routed to the derived implementation. 60. Should I Make My Destructor Virtual? A C# destructor is really just an override of the System.Object Finalize method, and so is virtual by definition. 61. Can I Use Exceptions In C#? Yes, in fact exceptions are the recommended error-handling mechanism in C# (and in .NET in general). Most of the .NET framework classes use exceptions to signal errors. 62. What Types Of Object Can I Throw As Exceptions? Only instances of the System.Exception classes, or classes derived from System.Exception. This is in sharp contrast with C++ where instances of almost any type can be thrown. 63. Can I Define My Own Exceptions? Yes, just derive your exception class from System.Exception. 64. Does The System.exception Class Have Any Cool Features? Yes - the feature which stands out is the StackTrace property. This provides a call stack which records where the exception was thrown from. For example, the following code: using System; class CApp { public static void Main() { try { f(); } catch( Exception e ) { Console.WriteLine( "System.Exception stack trace = \n{0}", e.StackTrace ); } } static void f() { throw new Exception( "f went pear-shaped" ); } } produces this output: System.Exception stack trace = at CApp.f() at CApp.Main() Note, however, that this stack trace was produced from a debug build. A release build may optimise away some of the method calls which could mean that the call stack isn't quite what you expect. 65. When Should I Throw An Exception? This is the subject of some debate, and is partly a matter of taste. However, it is accepted by many that exceptions should be thrown only when an 'unexpected' error occurs. How do you decide if an error is expected or unexpected? This is a judgement call, but a straightforward example of an expected error is failing to read from a file because the seek pointer is at the end of the file, whereas an example of an unexpected error is failing to allocate memory from the heap. 66. Does C# Have A 'throws' Clause? No, unlike Java, C# does not require (or even allow) the developer to specify the exceptions that a method can throw. 67. How Can I Check The Type Of An Object At Runtime? You can use the is keyword. For example: using System; class CApp { public static void Main() { string s = "fred"; long i = 10; Console.WriteLine( "{0} is {1}an integer", s, (IsInteger(s) ? "" : "not ") ); Console.WriteLine( "{0} is {1}an integer", i, (IsInteger(i) ? "" : "not ") ); } static bool IsInteger( object obj ) { if( obj is int || obj is long ) return true; else return false; } } produces the output: fred is not an integer 10 is an integer 68. Can I Get The Name Of A Type At Runtime? Yes, use the GetType method of the object class (which all types inherit from). For example: using System; class CTest { class CApp { public static void Main() { long i = 10; CTest ctest = new CTest(); DisplayTypeInfo( ctest ); DisplayTypeInfo( i ); } static void DisplayTypeInfo( object obj ) { Console.WriteLine( "Type name = {0}, full type name = {1}", obj.GetType(), obj.GetType().FullName ); } } } produces the following output: Type name = CTest, full type name = CTest Type name = Int64, full type name = System.Int64 69. How Do I Do A Case-insensitive String Comparison? Use the String.Compare function. Its third parameter is a boolean which specifies whether case should be ignored or not. "fred" == "Fred" // false System.String.Compare( "fred", "Fred", true ) // true 70. Does C# Support A Variable Number Of Arguments? Yes, using the params keyword. The arguments are specified as a list of arguments of a specific type, e.g. int. For ultimate flexibility, the type can be object. The standard example of a method which uses this approach is System.Console.WriteLine(). 71. How Can I Process Command-line Arguments? Like this: using System; class CApp { public static void Main( string args ) { Console.WriteLine( "You passed the following arguments:" ); foreach( string arg in args ) Console.WriteLine( arg ); } } 72. Does C# Do Array Bounds Checking? Yes. An IndexOutOfRange exception is used to signal an error. 73. How Can I Make Sure My C# Classes Will Interoperate With Other .net Languages? Make sure your C# code conforms to the Common Language Subset (CLS). To help with this, add the global attribute to your C# source files. The compiler will emit an error if you use a C# feature which is not CLS-compliant. 74. How Do I Use The 'using' Keyword With Multiple Objects? You can nest using statements, like this: using( obj1 ) { using( obj2 ) { ... } } However consider using this more aesthetically pleasing (but functionally identical) formatting: using( obj1 ) using( obj2 ) { ... } 75. What Is The Difference Between == And Object.equals? For value types, == and Equals() usually compare two objects by value. For example: int x = 10; int y = 10; Console.WriteLine( x == y ); Console.WriteLine( x.Equals(y) ); will display: True True However things are more complex for reference types. Generally speaking, for reference types == is expected to perform an identity comparison, i.e. it will only return true if both references point to the same object. By contrast, Equals() is expected to perform a value comparison, i.e. it will return true if the references point to objects that are equivalent. For example: StringBuilder s1 = new StringBuilder("fred"); StringBuilder s2 = new StringBuilder("fred"); Console.WriteLine( s1 == s2 ); Console.WriteLine( s1.Equals(s2) ); will display: False True s1 and s2 are different objects (hence == returns false), but they are equivalent (hence Equals() returns true). Unfortunately there are exceptions to these rules. The implementation of Equals() in System.Object (the one you'll inherit by default if you write a class) compares identity, i.e. it's the same as operator==. So Equals() only tests for equivalence if the class author overrides the method (and implements it correctly). Another exception is the string class - its operator== compares value rather than identity. Bottom line: If you want to perform an identity comparison use the ReferenceEquals() method. If you want to perform a value comparison, use Equals() but be aware that it will only work if the type has overridden the default implementation. Avoid operator== with reference types (except perhaps strings), as it's simply too ambiguous. 76. How Do I Enforce Const Correctness In C#? You can't - at least not in the same way you do in C++. C# (actually, the CLI) has no real concept of const correctness, For example, there's no way to specify that a method should not modify an argument passed in to it. And there's no way to specify that a method does not modify the object on which it is acting. To get a feel for the angst this causes among some C++ programmers, read the feedback on this post from Raymond Chen. There are of course ways of addressing this issue. For example, see Brad Abram's post (and associated feedback) for some ideas on adding optional read-only behaviour to collection classes. 77. What Are The New Features In C# 2.0? Support for all of the new framework features such as generics, anonymous methods, partial classes, iterators and static classes. Delegate inference is a new feature of the C# compiler which makes delegate usage a little simpler. It allows you to write this: Thread t = new Thread(ThreadFunc); instead of this: Thread t = new Thread( new ThreadStart(ThreadFunc) ); Another minor but welcome addition is the explicit global namespace, which fixes a hole in namespace usage in C# 1.x. You can prefix a type name with global:: to indicate that the type belongs to the global namespace, thus avoiding problems where the compiler infers the namespace and gets it wrong. Finally C# 2.0 includes some syntactic sugar for the new System.Nullable type. You can use T? as a synonym for System.Nullable, where T is a value type. As suggested by the name, this allows values of the type to be 'null', or 'undefined'. 78. Are C# Generics The Same As C++ Templates? No, not really. There are some similarities, but there are also fundamental differences. 79. What Is An Interface In C#? An Interface in C# is created using the interface keyword. An example is shown below. using System; namespace Interfaces { interface IBankCustomer { void DepositMoney(); void WithdrawMoney(); } public class Demo : IBankCustomer { public void DepositMoney() { Console.WriteLine("Deposit Money"); } public void WithdrawMoney() { Console.WriteLine("Withdraw Money"); } public static void Main() { Demo DemoObject = new Demo(); DemoObject.DepositMoney(); DemoObject.WithdrawMoney(); } } } In our example we created IBankCustomer interface. The interface declares 2 methods. 1. void DepositMoney(); 2. void WithdrawMoney(); Notice that method declarations does not have access modifiers like public, private, etc. By default all interface members are public. It is a compile time error to use access modifiers on interface member declarations. Also notice that the interface methods have only declarations and not implementation. It is a compile time error to provide implementation for any interface member. In our example as the Demo class is inherited from the IBankCustomer interface, the Demo class has to provide the implementation for both the methods (WithdrawMoney() and DepositMoney()) that is inherited from the interface. If the class fails to provide implementation for any of the inherited interface member, a compile time error will be generated. Interfaces can consist of methods, properties, events, indexers, or any combination of those four member types. When a class or a struct inherits an interface, the class or struct must provide implementation for all of the members declared in the interface. The interface itself provides no functionality that a class or struct can inherit in the way that base class functionality can be inherited. However, if a base class implements an interface, the derived class inherits that implementation. 80. Can An Interface Contain Fields? No, an Interface cannot contain fields. 81. What Is The Difference Between Class Inheritance And Interface Inheritance? Classes and structs can inherit from interfaces just like how classes can inherit a base class or struct. However there are 2 differences. 1. A class or a struct can inherit from more than one interface at the same time where as A class or a struct cannot inherit from more than one class at the same time. An example depicting the same is shown below. using System; namespace Interfaces { interface Interface1 { void Interface1Method(); } interface Interface2 { void Interface2Method(); } class BaseClass1 { public void BaseClass1Method() { Console.WriteLine("BaseClass1 Method"); } } class BaseClass2 { public void BaseClass2Method() { Console.WriteLine("BaseClass2 Method"); } } //Error : A class cannot inherit from more than one class at the same time //class DerivedClass : BaseClass1, BaseClass2 //{ //} //A class can inherit from more than one interface at the same time public class Demo : Interface1, Interface2 { public void Interface1Method() { Console.WriteLine("Interface1 Method"); } public void Interface2Method() { Console.WriteLine("Interface2 Method"); } public static void Main() { Demo DemoObject = new Demo(); DemoObject.Interface1Method(); DemoObject.Interface2Method(); } } } 2. When a class or struct inherits an interface, it inherits only the method names and signatures, because the interface itself contains no implementations. 82. Can An Interface Inherit From Another Interface? Yes, an interface can inherit from another interface. It is possible for a class to inherit an interface multiple times, through base classes or interfaces it inherits. In this case, the class can only implement the interface one time, if it is declared as part of the new class. If the inherited interface is not declared as part of the new class, its implementation is provided by the base class that declared it. It is possible for a base class to implement interface members using virtual members; in that case, the class inheriting the interface can change the interface behavior by overriding the virtual members. 83. Can You Create An Instance Of An Interface? No, you cannot create an instance of an interface. 84. If A Class Inherits An Interface, What Are The 2 Options Available For That Class? Option 1: Provide Implementation for all the members inheirted from the interface. namespace Interfaces { interface Interface1 { void Interface1Method(); } class BaseClass1 : Interface1 { public void Interface1Method() { Console.WriteLine("Interface1 Method"); } public void BaseClass1Method() { Console.WriteLine("BaseClass1 Method"); } } } Option 2: If the class does not wish to provide Implementation for all the members inheirted from the interface, then the class has to be marked as abstract. namespace Interfaces { interface Interface1 { void Interface1Method(); } abstract class BaseClass1 : Interface1 { abstract public void Interface1Method(); public void BaseClass1Method() { Console.WriteLine("BaseClass1 Method"); } } } 85. A Class Inherits From 2 Interfaces And Both The Interfaces Have The Same Method Name As Shown Below. How Should The Class Implement The Drive Method For Both Car And Bus Interface? namespace Interfaces { interface Car { void Drive(); } interface Bus { void Drive(); } class Demo : Car,Bus { //How to implement the Drive() Method inherited from Bus and Car } } To implement the Drive() method use the fully qualified name as shown in the example below. To call the respective interface drive method type cast the demo object to the respective interface and then call the drive method. using System; namespace Interfaces { interface Car { void Drive(); } interface Bus { void Drive(); } class Demo : Car,Bus { void Car.Drive() { Console.WriteLine("Drive Car"); } void Bus.Drive() { Console.WriteLine("Drive Bus"); } static void Main() { Demo DemoObject = new Demo(); ((Car)DemoObject).Drive(); ((Bus)DemoObject).Drive(); } } } 86. What Do You Mean By "explicitly Implemeting An Interface". Give An Example? If a class is implementing the inherited interface member by prefixing the name of the interface, then the class is "Explicitly Implemeting an Interface member". The disadvantage of Explicitly Implemeting an Interface member is that, the class object has to be type casted to the interface type to invoke the interface member. An example is shown below. using System; namespace Interfaces { interface Car { void Drive(); } class Demo : Car { // Explicit implementation of an interface member void Car.Drive() { Console.WriteLine("Drive Car"); } static void Main() { Demo DemoObject = new Demo(); //DemoObject.Drive(); // Error: Cannot call explicitly implemented interface method // using the class object. // Type cast the demo object to interface type Car ((Car)DemoObject).Drive(); } } } 87. What Is A Partial Class. Give An Example? A partial class is a class whose definition is present in 2 or more files. Each source file contains a section of the class, and all parts are combined when the application is compiled. To split a class definition, use the partial keyword as shown in the example below. Student class is split into 2 parts. The first part defines the study() method and the second part defines the Play() method. When we compile this program both the parts will be combined and compiled. Note that both the parts uses partial keyword and public access modifier. using System; namespace PartialClass { public partial class Student { public void Study() { Console.WriteLine("I am studying"); } } public partial class Student { public void Play() { Console.WriteLine("I am Playing"); } } public class Demo { public static void Main() { Student StudentObject = new Student(); StudentObject.Study(); StudentObject.Play(); } }} It is very important to keep the following points in mind when creating partial classes. All the parts must use the partial keyword. All the parts must be available at compile time to form the final class. All the parts must have the same access modifiers - public, private, protected etc. Any class members declared in a partial definition are available to all the other parts. The final class is the combination of all the parts at compile time. 88. What Are The Advantages Of Using Partial Classes? When working on large projects, spreading a class over separate files enables multiple programmers to work on it at the same time. When working with automatically generated source, code can be added to the class without having to recreate the source file. Visual Studio uses this approach when it creates Windows Forms, Web service wrapper code, and so on. You can create code that uses these classes without having to modify the file created by Visual Studio. 89. Is It Possible To Create Partial Structs, Interfaces And Methods? Yes, it is possible to create partial structs, interfaces and methods. We can create partial structs, interfaces and methods the same way as we create partial classes. 90. Will The Following Code Compile? using System; namespace PartialClass { public partial class Student { public void Study() { Console.WriteLine("I am studying"); } } public abstract partial class Student { public void Play() { Console.WriteLine("I am Playing"); } } public class Demo { public static void Main() { Student StudentObject = new Student(); } }} No, a compile time error will be generated stating "Cannot create an instance of the abstract class or interface "PartialClass.Student". This is because, if any part is declared abstract, then the whole class becomes abstract. Similarly if any part is declared sealed, then the whole class becomes sealed and if any part declares a base class, then the whole class inherits that base class. 91. Can You Create Partial Delegates And Enumerations? No, you cannot create partial delegates and enumerations. 92. Can Different Parts Of A Partial Class Inherit From Different Interfaces? Yes, different parts of a partial class can inherit from different interfaces. 93. Can You Specify Nested Classes As Partial Classes? Yes, nested classes can be specified as partial classes even if the containing class is not partial. An example is shown below. class ContainerClass { public partial class Nested { void Test1() { } } public partial class Nested { void Test2() { } } } 94. How Do You Create Partial Methods? To create a partial method we create the declaration of the method in one part of the partial class and implementation in the other part of the partial class. The implementation is optional. If the implementation is not provided, then the method and all the calls to the method are removed at compile time. Therefore, any code in the partial class can freely use a partial method, even if the implementation is not supplied. No compile-time or run-time errors will result if the method is called but not implemented. In summary a partial method declaration consists of two parts. The definition, and the implementation. These may be in separate parts of a partial class, or in the same part. If there is no implementation declaration, then the compiler optimizes away both the defining declaration and all calls to the method. The following are the points to keep in mind when creating partial methods. Partial method declarations must begin partial keyword. The return type of a partial method must be void. Partial methods can have ref but not out parameters. Partial methods are implicitly private, and therefore they cannot be virtual. Partial methods cannot be extern, because the presence of the body determines whether they are defining or implementing. 95. What Is The Use Of Partial Methods? Partial methods can be used to customize generated code. They allow for a method name and signature to be reserved, so that generated code can call the method but the developer can decide whether to implement the method. Much like partial classes, partial methods enable code created by a code generator and code created by a human developer to work together without run-time costs. 96. What Is A Nested Type. Give An Example? A type(class or a struct) defined inside another class or struct is called a nested type. An example is shown below. InnerClass is inside ContainerClass, Hence InnerClass is called as nested class. using System; namespace Nested { class ContainerClass { class InnerClass { public string str = "A string variable in nested class"; } public static void Main() { InnerClass nestedClassObj = new InnerClass(); Console.WriteLine(nestedClassObj.str); } } } 97. Can The Nested Class Access, The Containing Class. Give An Example? Yes, the nested class, or inner class can access the containing or outer class as shown in the example below. Nested types can access private and protected members of the containing type, including any inherited private or protected members. using System; namespace Nested { class ContainerClass { string OuterClassVariable = "I am an outer class variable"; public class InnerClass { ContainerClass ContainerClassObject = new ContainerClass(); string InnerClassVariable = "I am an Inner class variable"; public InnerClass() { Console.WriteLine(ContainerClassObject.OuterClassVariable); Console.WriteLine(this.InnerClassVariable); } } } class Demo { public static void Main() { ContainerClass.InnerClass nestedClassObj = new ContainerClass.InnerClass(); } } } 98. What Is The Ouput Of The Following Program? using System; namespace Nested { class ContainerClass { public ContainerClass() { Console.WriteLine("I am a container class"); } public class InnerClass : ContainerClass { public InnerClass() { Console.WriteLine("I am an inner class"); } } } class DemoClass : ContainerClass.InnerClass { public DemoClass() { Console.WriteLine("I am a Demo class"); } public static void Main() { DemoClass DC = new DemoClass(); } } } Output: I am a container class I am an inner class I am a Demo class The above program has used the concepts of inheritance and nested classes. The ContainerClass is at the top in the inheritance chain. The nested InnerClass derives from outer ContainerClass. Finally the DemoClass derives from nested InnerClass. As all the 3 classes are related by inheritance we have the above output. 99. What Is A Destructor? A Destructor has the same name as the class with a tilde character and is used to destroy an instance of a class. 100. Can A Class Have More Than 1 Destructor? No, a class can have only 1 destructor. 101. Can Structs In C# Have Destructors? No, structs can have constructors but not destructors, only classes can have destructors. 102. Can You Pass Parameters To Destructors? No, you cannot pass parameters to destructors. Hence, you cannot overload destructors. 103. Can You Explicitly Call A Destructor? No, you cannot explicitly call a destructor. Destructors are invoked automatically by the garbage collector. 104. Why Is It Not A Good Idea To Use Empty Destructors? When a class contains a destructor, an entry is created in the Finalize queue. When the destructor is called, the garbage collector is invoked to process the queue. If the destructor is empty, this just causes a needless loss of performance. 105. Is It Possible To Force Garbage Collector To Run? Yes, it possible to force garbage collector to run by calling the Collect() method, but this is not considered a good practice because this might create a performance over head. Usually the programmer has no control over when the garbage collector runs. The garbage collector checks for objects that are no longer being used by the application. If it considers an object eligible for destruction, it calls the destructor(if there is one) and reclaims the memory used to store the object. 106. Usually In .net, The Clr Takes Care Of Memory Management. Is There Any Need For A Programmer To Explicitly Release Memory And Resources? If Yes, Why And How? If the application is using expensive external resource, it is recommend to explicitly release the resource before the garbage collector runs and frees the object. We can do this by implementing the Dispose method from the IDisposable interface that performs the necessary cleanup for the object. This can considerably improve the performance of the application. 107. When Do We Generally Use Destructors To Release Resources? If the application uses unmanaged resources such as windows, files, and network connections, we use destructors to release resources. 108. What Is A Constructor In C#? Constructor is a class method that is executed when an object of a class is created. Constructor has the same name as the class, and usually used to initialize the data members of the new object. 109. In C#, What Will Happen If You Do Not Explicitly Provide A Constructor For A Class? If you do not provide a constructor explicitly for your class, C# will create one by default that instantiates the object and sets all the member variables to their default values. 110. Structs Are Not Reference Types. Can Structs Have Constructors? Yes, even though Structs are not reference types, structs can have constructors. 111. We Cannot Create Instances Of Static Classes. Can We Have Constructors For Static Classes? Yes, static classes can also have constructors. 112. Can You Prevent A Class From Being Instantiated? Yes, a class can be prevented from being instantiated by using a private constructor as shown in the example below. using System; namespace TestConsole { class Program { public static void Main() { //Error cannot create instance of a class with private constructor SampleClass SC = new SampleClass(); } } class SampleClass { double PI = 3.141; private SampleClass() { } } } 113. Can A Class Or A Struct Have Multiple Constructors? Yes, a class or a struct can have multiple constructors. Constructors in csharp can be overloaded. 114. Can A Child Class Call The Constructor Of A Base Class? Yes, a child class can call the constructor of a base class by using the base keyword as shown in the example below. using System; namespace TestConsole { class BaseClass { public BaseClass(string str) { Console.WriteLine(str); } } class ChildClass : BaseClass { public ChildClass(string str): base(str) { } public static void Main() { ChildClass CC = new ChildClass("Calling base class constructor from child class"); } } } 115. If A Child Class Instance Is Created, Which Class Constructor Is Called First - Base Class Or Child Class? When an instance of a child class is created, the base class constructor is called before the child class constructor. An example is shown below. using System; namespace TestConsole { class BaseClass { public BaseClass() { Console.WriteLine("I am a base class constructor"); } } class ChildClass : BaseClass { public ChildClass() { Console.WriteLine("I am a child class constructor"); } public static void Main() { ChildClass CC = new ChildClass(); } } } 116. Can A Class Have Static Constructor? Yes, a class can have static constructor. Static constructors are called automatically, immediately before any static fields are accessed, and are generally used to initialize static class members. It is called automatically before the first instance is created or any static members are referenced. Static constructors are called before instance constructors. An example is shown below. using System; namespace TestConsole { class Program { static int I; static Program() { I = 100; Console.WriteLine("Static Constructor called"); } public Program() { Console.WriteLine("Instance Constructor called"); } public static void Main() { Program P = new Program(); } } } 117. Can You Mark Static Constructor With Access Modifiers? No, we cannot use access modifiers on static constructor. 118. Can You Have Parameters For Static Constructors? No, static constructors cannot have parameters. 119. What Happens If A Static Constructor Throws An Exception? If a static constructor throws an exception, the runtime will not invoke it a second time, and the type will remain uninitialized for the lifetime of the application domain in which your program is running. 120. Give 2 Scenarios Where Static Constructors Can Be Used? 1. A typical use of static constructors is when the class is using a log file and the constructor is used to write entries to this file. 2. Static constructors are also useful when creating wrapper classes for unmanaged code, when the constructor can call the LoadLibrary method. 121. Does C# Provide Copy Constructor? No, C# does not provide copy constructor. 122. Is The Following Code Legal? using System; namespace Demo { class Program { public static void Main() { } public void Sum(int FirstNumber, int SecondNumber) { int Result = FirstNumber + SecondNumber; } public int Sum(int FirstNumber, int SecondNumber) { int Result = FirstNumber + SecondNumber; } } } No, The above code does not compile. You cannot overload a method based on the return type. To overload a method in C# either the number or type of parameters should be different. In general the return type of a method is not part of the signature of the method for the purposes of method overloading. However, it is part of the signature of the method when determining the compatibility between a delegate and the method that it points to. 123. What Is The Difference Between Method Parameters And Method Arguments. Give An Example? In the example below FirstNumber and SecondNumber are method parameters where as FN and LN are method arguments. The method definition specifies the names and types of any parameters that are required. When calling code calls the method, it provides concrete values called arguments for each parameter. The arguments must be compatible with the parameter type but the argument name (if any) used in the calling code does not have to be the same as the parameter named defined in the method. using System; namespace Demo { class Program { public static void Main() { int FN = 10; int SN = 20; //FN and LN are method arguments int Total = Sum(FN, SN); Console.WriteLine(Total); } //FirstNumber and SecondNumber are method parameters public static int Sum(int FirstNumber, int SecondNumber) { int Result = FirstNumber + SecondNumber; return Result; } } } 124. Explain The Difference Between Passing Parameters By Value And Passing Parameters By Reference With An Example? We can pass parameters to a method by value or by reference. By default all value types are passed by value where as all reference types are passed by reference. By default, when a value type is passed to a method, a copy is passed instead of the object itself. Therefore, changes to the argument have no effect on the original copy in the calling method.An example is shown below. using System; namespace Demo { class Program { public static void Main() { int I = 10; int K = Function(I); Console.WriteLine("I = " + I); Console.WriteLine("K = " + K); } public static int Function(int Number) { int ChangedValue = Number + 1; return ChangedValue; } } } By default, reference types are passed by reference. When an object of a reference type is passed to a method, the reference points to the original object, not a copy of the object. Changes made through this reference will therefore be reflected in the calling method. Reference types are created by using the class keyword as shown in the example below. using System; namespace Demo { class Program { public static void Main() { ReferenceTypeExample Object = new ReferenceTypeExample(); Object.Number = 20; Console.WriteLine("Original Object Value = " + Object.Number); Function(Object); Console.WriteLine("Object Value after passed to the method= " + Object.Number); } public static void Function(ReferenceTypeExample ReferenceTypeObject) { ReferenceTypeObject.Number = ReferenceTypeObject.Number + 5; } } class ReferenceTypeExample { public int Number; } } 125. Can You Pass Value Types By Reference To A Method? Yes, we can pass value types by by reference to a method. An example is shown below. using System; namespace Demo { class Program { public static void Main() { int I = 10; Console.WriteLine("Value of I before passing to the method = " + I); Function(ref I); Console.WriteLine("Value of I after passing to the method by reference= " + I); } public static void Function(ref int Number) { Number = Number + 5; } } } 126. If A Method's Return Type Is Void, Can You Use A Return Keyword In The Method? Yes, Even though a method's return type is void, you can use the return keyword to stop the execution of the method as shown in the example below. using System; namespace Demo { class Program { public static void Main() { SayHi(); } public static void SayHi() { Console.WriteLine("Hi"); return; Console.WriteLine("This statement will never be executed"); } } } 127. What Are Properties In C#. Explain With An Example? Properties in C# are class members that provide a flexible mechanism to read, write, or compute the values of private fields. Properties can be used as if they are public data members, but they are actually special methods called accessors. This enables data to be accessed easily and still helps promote the safety and flexibility of methods. In the example below _firstName and _lastName are private string variables which are accessible only inside the Customer class. _firstName and _lastName are exposed using FirstName and LastName public properties respectively. The get property accessor is used to return the property value, and a set accessor is used to assign a new value. These accessors can have different access levels. The value keyword is used to define the value being assigned by the set accessor. The FullName property computes the full name of the customer. Full Name property is readonly, because it has only the get accessor. Properties that do not implement a set accessor are read only. The code block for the get accessor is executed when the property is read and the code block for the set accessor is executed when the property is assigned a new value. using System; class Customer { // Private fileds not accessible outside the class. private string _firstName = string.Empty; private string _lastName = string.Empty; private string _coutry = string.Empty; // public FirstName property exposes _firstName variable public string FirstName { get { return _firstName; } set { _firstName = value; } } // public LastName property exposes _lastName variable public string LastName { get { return _lastName; } set { _lastName = value; } } // FullName property is readonly and computes customer full name. public string FullName { get { return _lastName + ", " + _firstName; } } //Country Property is Write Only public string Country { set { _coutry = value; } } } class MainClass { public static void Main() { Customer CustomerObject = new Customer(); //This line will call the set accessor of FirstName Property CustomerObject.FirstName = "David"; //This line will call the set accessor of LastName Property CustomerObject.LastName = "Boon"; //This line will call the get accessor of FullName Property Console.WriteLine("Customer Full Name is : " + CustomerObject.FullName); } } 128. Explain The 3 Types Of Properties In C# With An Example? Read Only Properties: Properties without a set accessor are considered read-only. In the above example FullName is read only property. Write Only Properties: Properties without a get accessor are considered write-only. In the above example Country is write only property. Read Write Properties: Properties with both a get and set accessor are considered read-write properties. In the above example FirstName and LastName are read write properties. 129. What Are The Advantages Of Properties In C#? Properties can validate data before allowing a change. Properties can transparently expose data on a class where that data is actually retrieved from some other source such as a database. Properties can take an action when data is changed, such as raising an event or changing the value of other fields. 130. What Is A Static Property. Give An Example? A property that is marked with a static keyword is considered as static property. This makes the property available to callers at any time, even if no instance of the class exists. In the example below PI is a static property. using System; class Circle { private static double _pi = 3.14; public static double PI { get { return _pi; } } } class MainClass { public static void Main() { Console.WriteLine(Circle.PI); } } 131. What Is A Virtual Property. Give An Example? A property that is marked with virtual keyword is considered virtual property. Virtual properties enable derived classes to override the property behavior by using the override keyword. In the example below FullName is virtual property in the Customer class. BankCustomer class inherits from Customer class and overrides the FullName virtual property. In the output you can see the over riden implementation. A property overriding a virtual property can also be sealed, specifying that for derived classes it is no longer virtual. using System; class Customer { private string _firstName = string.Empty; private string _lastName = string.Empty; public string FirstName { get { return _firstName; } set { _firstName = value; } } public string LastName { get { return _lastName; } set { _lastName = value; } } // FullName is virtual public virtual string FullName { get { return _lastName + ", " + _firstName; } } } class BankCustomer : Customer { // Overiding the FullName virtual property derived from customer class public override string FullName { get { return "Mr. " + FirstName + " " + LastName; } } } class MainClass { public static void Main() { BankCustomer BankCustomerObject = new BankCustomer(); BankCustomerObject.FirstName = "David"; BankCustomerObject.LastName = "Boon"; Console.WriteLine("Customer Full Name is : " + BankCustomerObject.FullName); } } 132. What Is An Abstract Property. Give An Example? A property that is marked with abstract keyword is considered abstract property. An abstract property should not have any implementation in the class. The derived classes must write their own implementation. In the example below FullName property is abstract in the Customer class. BankCustomer class overrides the inherited abstract FullName property with its own implementation. using System; abstract class Customer { private string _firstName = string.Empty; private string _lastName = string.Empty; public string FirstName { get { return _firstName; } set { _firstName = value; } } public string LastName { get { return _lastName; } set { _lastName = value; } } // FullName is abstract public abstract string FullName { get; } } class BankCustomer : Customer { // Overiding the FullName abstract property derived from customer class public override string FullName { get { return "Mr. " + FirstName + " " + LastName; } } } class MainClass { public static void Main() { BankCustomer BankCustomerObject = new BankCustomer(); BankCustomerObject.FirstName = "David"; BankCustomerObject.LastName = "Boon"; Console.WriteLine("Customer Full Name is : " + BankCustomerObject.FullName); } } 133. Can You Use Virtual, Override Or Abstract Keywords On An Accessor Of A Static Property? No, it is a compile time error to use a virtual, abstract or override keywords on an accessor of a static property. 134. What Are Constants In C#? Constants in C# are immutable values which are known at compile time and do not change for the life of the program. Constants are declared using the const keyword. Constants must be initialized as they are declared. You cannot assign a value to a constant after it isdeclared. An example is shown below. using System; class Circle { public const double PI = 3.14; public Circle() { //Error : You can only assign a value to a constant field at the time of declaration //PI = 3.15; } } class MainClass { public static void Main() { Console.WriteLine(Circle.PI); } } 135. Can You Declare A Class Or A Struct As Constant? No, User-defined types including classes, structs, and arrays, cannot be const. Only the C# built-in types excluding System.Object may be declared as const. Use the readonly modifier to create a class, struct, or array that is initialized one time at runtime (for example in a constructor) and thereafter cannot be changed. 136. Does C# Support Const Methods, Properties, Or Events? No, C# does not support const methods, properties, or events. 137. Can You Change The Value Of A Constant Filed After Its Declaration? No, you cannot change the value of a constant filed after its declaration. In the example below, the constant field PI is always 3.14, and it cannot be changed even by the class itself. In fact, when the compiler encounters a constant identifier in C# source code (for example, PI), it substitutes the literal value directly into the intermediate language (IL) code that it produces. Because there is no variable address associated with a constant at run time, const fields cannot be passed by reference. using System; class Circle { public const double PI = 3.14; } 138. How Do You Access A Constant Field Declared In A Class? Constants are accessed as if they were static fields because the value of the constant is the same for all instances of the type. You do not use the static keyword to declare them. Expressions that are not in the class that defines the constant must use the class name, a period, and the name of the constant to access the constant. In the example below constant field PI can be accessed in the Main method using the class name and not the instance of the class. Trying to access a constant field using a class instance will generate a compile time error. using System; class Circle { public const double PI = 3.14; } class MainClass { public static void Main() { Console.WriteLine(Circle.PI); Circle C = new Circle(); // Error : PI cannot be accessed using an instance // Console.WriteLine(C.PI); } } 139. What Are The 2 Broad Classifications Of Fields In C#? Instance fields Static fields 140. What Are Instance Fields In C#? Instance fields are specific to an instance of a type. If you have a class T, with an instance field F, you can create two objects of type T, and modify the value of F in each object without affecting the value in the other object. 141. What Is A Static Field? A static field belongs to the class itself, and is shared among all instances of that class. Changes made from instance A will be visible immediately to instances B and C if they access the field. 142. Can You Declare A Field Readonly? Yes, a field can be declared readonly. A read-only field can only be assigned a value during initialization or in a constructor. An example is shown below. using System; class Area { public readonly double PI = 3.14; } class MainClass { public static void Main() { Area A = new Area(); Console.WriteLine(A.PI); } } 143. What Is Wrong With The Sample Program Below? using System; class Area { public const double PI = 3.14; static Area() { Area.PI = 3.15; } } class MainClass { public static void Main() { Console.WriteLine(Area.PI); } } You cannot assign a value to the constant PI field. 144. What Is The Difference Between A Constant And A Static Readonly Field? A static readonly field is very similar to a constant, except that the C# compiler does not have access to the value of a static read-only field at compile time, only at run time. 145. What Are Access Modifiers In C#? In C# there are 5 different types of Access Modifiers. 1. Public The public type or member can be accessed by any other code in the same assembly or another assembly that references it. 2. Private The type or member can only be accessed by code in the same class or struct. 3. Protected The type or member can only be accessed by code in the same class or struct, or in a derived class. 4. Internal The type or member can be accessed by any code in the same assembly, but not from another assembly. 5. Protected Internal The type or member can be accessed by any code in the same assembly, or by any derived class in another assembly. 146. What Are Access Modifiers Used For? Access Modifiers are used to control the accessibilty of types and members with in the types. 147. Can You Use All Access Modifiers For All Types? No, Not all access modifiers can be used by all types or members in all contexts, and in some cases the accessibility of a type member is constrained by the accessibility of its containing type. 148. Can Derived Classes Have Greater Accessibility Than Their Base Types? No, Derived classes cannot have greater accessibility than their base types. For example the following code is illegal. using System; internal class InternalBaseClass { public void Print() { Console.WriteLine("I am a Base Class Method"); } } public class PublicDerivedClass : InternalBaseClass { public static void Main() { Console.WriteLine("I am a Public Derived Class Method"); } } When you compile the above code an error will be generated stating "Inconsistent accessibility: base class InternalBaseClass is less accessible than class PublicDerivedClass".To make this simple, you cannot have a public class B that derives from an internal class A. If this were allowed, it would have the effect of making A public, because all protected or internal members of A are accessible from the derived class. 149. Can You Declare Struct Members As Protected? No, struct members cannot be declared protected. This is because structs do not support inheritance. 150. Can The Accessibility Of A Type Member Be Greater Than The Accessibility Of Its Containing Type? No, the accessibility of a type member can never be greater than the accessibility of its containing type. For example, a public method declared in an internal class has only internal accessibility. 151. Can Destructors Have Access Modifiers? No, destructors cannot have access modifiers. 152. What Does Protected Internal Access Modifier Mean? The protected internal access means protected OR internal, not protected AND internal. In simple terms, a protected internal member is accessible from any class in the same assembly, including derived classes. To limit accessibility to only derived classes in the same assembly, declare the class itself internal, and declare its members as protected. 153. What Is The Default Access Modifier For A Class,struct And An Interface Declared Directly With A Namespace? internal. 154. Can You Specify An Access Modifier For An Enumeration? Enumeration members are always public, and no access modifiers can be specified. 155. What Are The 3 Types Of Comments In C#? 1. Single Line Comments. You define single line comments with // as shown below. //This is an example for single line comment 2. Multi line comments. You define multi line comments with /* */ as shown below. /*This is an example for Multi Line comments*/ 3. XML Comments. You define XML comments with /// as shown below. ///This is an example for defining XML comments. 156. Is C# A Strongly-typed Language? Yes. 157. What Are The 2 Broad Classifications Of Data Types Available In C#? Built in data types. User defined data types. 158. Give Some Examples For Built In Datatypes In C#? int float bool 159. How Do You Create User Defined Data Types In C#? You use the struct, class, interface, and enum constructs to create your own custom types. The .NET Framework class library itself is a collection of custom types provided by Microsoft that you can use in your own applications. 160. What Are The 2 Types Of Data Types Available In C#? Value Types Reference Types 161. If You Define A User Defined Data Type By Using The Struct Keyword, Is It A Value Type Or Reference Type? Value Type. 162. If You Define A User Defined Data Type By Using The Class Keyword, Is It A Value Type Or Reference Type? Reference type 163. Are Value Types Sealed? Yes, Value types are sealed. 164. What Is The Base Class From Which All Value Types Are Derived? System.ValueType. 165. Give Examples For Value Types? Enum Struct 166. Give Examples For Reference Types? Class Delegate Array Interface. 167. What Are The Differences Between Value Types And Reference Types? Value types are stored on the stack where as reference types are stored on the managed heap. Value type variables directly contain their values where as reference variables holds only a reference to the location of the object that is created on the managed heap. There is no heap allocation or garbage collection overhead for value-type variables. As reference types are stored on the managed heap, they have the over head of object allocation and garbage collection. Value Types cannot inherit from another class or struct. Value types can only inherit from interfaces. Reference types can inherit from another class or interface. 168. What Do You Mean By Casting A Data Type? Converting a variable of one data type to another data type is called casting. This is also called as data type conversion. 169. What Are The 2 Kinds Of Data Type Conversions In C#? Implicit conversions: No special syntax is required because the conversion is type safe and no data will be lost. Examples include conversions from smaller to larger integral types, and conversions from derived classes to base classes. Explicit conversions: Explicit conversions require a cast operator. The source and destination variables are compatible, but there is a risk of data loss because the type of the destination variable is a smaller size than (or is a base class of) the source variable. 170. What Is The Difference Between An Implicit Conversion And An Explicit Conversion? Explicit conversions require a cast operator where as an implicit converstion is done automatically. Explicit conversion can lead to data loss where as with implicit conversions there is no data loss. 171. What Type Of Data Type Conversion Happens When The Compiler Encounters The Following Code? ChildClass CC = new ChildClass(); ParentClass PC = new ParentClass(); Implicit Conversion. For reference types, an implicit conversion always exists from a class to any one of its direct or indirect base classes or interfaces. No special syntax is necessary because a derived class always contains all the members of a base class. 172. If You Want To Convert A Base Type To A Derived Type, What Type Of Conversion Do You Use? Explicit conversion as shown below. //Create a new derived type. Car C1 = new Car(); // Implicit conversion to base type is safe. Vehicle V = C1; // Explicit conversion is required to cast back to derived type. The code below will compile but throw an exception at run time if the right-side object is not a Car object. Car C2 = (Car) V; 173. What Operators Can Be Used To Cast From One Reference Type To Another Without The Risk Of Throwing An Exception? The is and as operators can be used to cast from one reference type to another without the risk of throwing an exception. 174. If Casting Fails What Type Of Exception Is Thrown? InvalidCastException. 175. What Is Boxing And Unboxing? Boxing - Converting a value type to reference type is called boxing. An example is shown below. int i = 101; object obj = (object)i; // Boxing Unboxing - Converting a reference type to a value typpe is called unboxing. An example is shown below. obj = 101; i = (int)obj; // Unboxing 176. Is Boxing An Implicit Conversion? Yes, boxing happens implicitly. 177. Is Unboxing An Implicit Conversion? No, unboxing is an explicit conversion. 178. What Happens During The Process Of Boxing? Boxing is used to store value types in the garbage-collected heap. Boxing is an implicit conversion of a value type to the type object or to any interface type implemented by this value type. Boxing a value type allocates an object instance on the heap and copies the value into the new object. Due to this boxing and unboxing can have performance impact. 179. What Is An Array? An array is a data structure that contains several variables of the same type. 180. What Are The 3 Different Types Of Arrays? Single-Dimensional Multidimensional Jagged 181. What Is Jagged Array? A jagged array is an array of arrays. 182. Are Arrays Value Types Or Reference Types? Arrays are reference types. 183. What Is The Base Class For Array Types? System.Array. 184. Can You Use Foreach Iteration On Arrays In C#? Yes,Since array type implements IEnumerable, you can use foreach iteration on all arrays in C#. 185. What Is The Difference Between String Keyword And System.string Class? string keyword is an alias for Syste.String class. Therefore, System.String and string keyword are the same, and you can use whichever naming convention you prefer. The String class provides many methods for safely creating, manipulating, and comparing strings. 186. Are String Objects Mutable Or Immutable? String objects are immutable. 187. What Do You Mean By String Objects Are Immutable? String objects are immutable means, they cannot be changed after they have been created. All of the String methods and C# operators that appear to modify a string actually return the results in a new string object. In the following example, when the contents of s1 and s2 are concatenated to form a single string, the two original strings are unmodified. The += operator creates a new string that contains the combined contents. That new object is assigned to the variable s1, and the original object that was assigned to s1 is released for garbage collection because no other variable holds a reference to it. string s1 = "First String "; string s2 = "Second String"; // Concatenate s1 and s2. This actually creates a new // string object and stores it in s1, releasing the // reference to the original object. s1 += s2; System.Console.WriteLine(s1); // Output: First String Second String. 188. What Will Be The Output Of The Following Code? string str1 = "Hello "; string str2 = s1; str1 = str1 + "C#"; System.Console.WriteLine(s2); The output of the above code is "Hello" and not "Hello C#". This is bcos, if you create a reference to a string, and then "modify" the original string, the reference will continue to point to the original object instead of the new object that was created when the string was modified. 189. What Is A Verbatim String Literal And Why Do We Use It? The "@" symbol is the verbatim string literal. Use verbatim strings for convenience and better readability when the string text contains backslash characters, for example in file paths. Because verbatim strings preserve new line characters as part of the string text, they can be used to initialize multiline strings. Use double quotation marks to embed a quotation mark inside a verbatim string. The following example shows some common uses for verbatim strings: string ImagePath = @"C:\Images\Buttons\SaveButton.jpg"; //Output: C:\Images\Buttons\SaveButton.jpg string MultiLineText = @"This is multiline Text written to be in three lines."; /* Output: This is multiline Text written to be in three lines. */ string DoubleQuotesString = @"My Name is ""Vankat."""; //Output: My Name is "Vankat." 190. Will The Following Code Compile And Run? string str = null; Console.WriteLine(str.Length); The above code will compile, but at runtime System.NullReferenceException will be thrown 191. How Do You Create Empty Strings In C#? Using string.empty as shown in the example below. string EmptyString = string.empty; 192. What Is The Difference Between System.text.stringbuilder And System.string? Objects of type StringBuilder are mutable where as objects of type System.String are immutable. As StringBuilder objects are mutable, they offer better performance than string objects of type System.String StringBuilder class is present in System.Text namespace where String class is present in System namespace. 193. How Do You Determine Whether A String Represents A Numeric Value? To determine whether a String represents a numeric value use TryParse method as shown in the example below. If the string contains nonnumeric characters or the numeric value is too large or too small for the particular type you have specified, TryParse returns false and sets the out parameter to zero. Otherwise, it returns true and sets the out parameter to the numeric value of the string. string str = "One"; int i = 0; if(int.TryParse(str,out i)) { Console.WriteLine("Yes string contains Integer and it is " + i); } else { Console.WriteLine("string does not contain Integer"); } 194. What Is The Difference Between Int.parse And Int.tryparse Methods? Parse method throws an exception if the string you are trying to parse is not a valid number where as TryParse returns false and does not throw an exception if parsing fails. Hence TryParse is more efficient than Parse. 195. Why Should You Override The Tostring() Method? All types in .Net inherit from system.object directly or indirectly. Because of this inheritance, every type in .Net inherit the ToString() method from System.Object class. Consider the example below. using System; public class MainClass { public static void Main() { int Number = 10; Console.WriteLine(Number.ToString()); } } In the above example Number.ToString() method will correctly give the string representaion of int 10, when you call the ToString() method. If you have a Customer class as shown in the below example and when you call the ToString() method the output doesnot make any sense. Hence you have to override the ToString() method, that is inherited from the System.Object class. using System; public class Customer { public string FirstName; public string LastName; } public class MainClass { public static void Main() { Customer C = new Customer(); C.FirstName = "David"; C.LastName = "Boon"; Console.WriteLine(C.ToString()); } } The code sample below shows how to override the ToString() method in a class, that would give the output you want. using System; public class Customer { public string FirstName; public string LastName; public override string ToString() { return LastName + ", " + FirstName; } } public class MainClass { public static void Main() { Customer C = new Customer(); C.FirstName = "David"; C.LastName = "Boon"; Console.WriteLine(C.ToString()); } } Conclusion : If you have a class or a struct, make sure you override the inherited ToString() method. 196. Explain Polymorphism In C# With A Simple Example? Polymorphism allows you to invoke derived class methods through a base class reference during run-time. An example is shown below. using System; public class DrawingObject { public virtual void Draw() { Console.WriteLine("I am a drawing object."); } } public class Triangle : DrawingObject { public override void Draw() { Console.WriteLine("I am a Triangle."); } } public class Circle : DrawingObject { public override void Draw() { Console.WriteLine("I am a Circle."); } } public class Rectangle : DrawingObject { public override void Draw() { Console.WriteLine("I am a Rectangle."); } } public class DrawDemo { public static void Main() { DrawingObject DrawObj = new DrawingObject; DrawObj = new Triangle(); DrawObj = new Circle(); DrawObj = new Rectangle(); DrawObj = new DrawingObject(); foreach (DrawingObject drawObj in DrawObj) { drawObj.Draw(); } } } 197. When Can A Derived Class Override A Base Class Member? A derived class can override a base class member only if the base class member is declared as virtual or abstract. 198. What Is The Difference Between A Virtual Method And An Abstract Method? A virtual method must have a body where as an abstract method should not have a body. 199. Can Fields Inside A Class Be Virtual? No, Fields inside a class cannot be virtua. Only methods, properties, events and indexers can be virtual. 200. Give An Example To Show For Hiding Base Class Methods? Use the new keyword to hide a base class method in the derived class as shown in the example below. using System; public class BaseClass { public virtual void Method() { Console.WriteLine("I am a base class method."); } } public class DerivedClass : BaseClass { public new void Method() { Console.WriteLine("I am a child class method."); } public static void Main() { DerivedClass DC = new DerivedClass(); DC.Method(); } } 201. Can You Access A Hidden Base Class Method In The Derived Class? Yes, Hidden base class methods can be accessed from the derived class by casting the instance of the derived class to an instance of the base class as shown in the example below. using System; public class BaseClass { public virtual void Method() { Console.WriteLine("I am a base class method."); } } public class DerivedClass : BaseClass { public new void Method() { Console.WriteLine("I am a child class method."); } public static void Main() { DerivedClass DC = new DerivedClass(); ((BaseClass)DC).Method(); } } 202. What Is An Abstract Class? An abstract class is an incomplete class and must be implemented in a derived class. 203. Can You Create An Instance Of An Abstract Class? No, abstract classes are incomplete and you cannot create an instance of an abstract class. 204. What Is A Sealed Class? A sealed class is a class that cannot be inherited from. This means, If you have a class called Customer that is marked as sealed. No other class can inherit from Customer class. For example, the below code generates a compile time error "MainClass cannot derive from sealed type Customer. using System; public sealed class Customer { } public class MainClass : Customer { public static void Main() { } } 205. What Are Abstract Methods? Abstract methods are methods that only the declaration of the method and no implementation. 206. How Can You Force Derived Classes To Provide New Method Implementations For Virtual Methods? Abstract classes can be used to force derived classes to provide new method implementations for virtual methods. An example is shown below. public class BaseClass { public virtual void Method() { // Original Implementation. } } public abstract class AbstractClass : BaseClass { public abstract override void Method(); } public class NonAbstractChildClass : AbstractClass { public override void Method() { // New implementation. } } When an abstract class inherits a virtual method from a base class, the abstract class can override the virtual method with an abstract method. If a virtual method is declared abstract, it is still virtual to any class inheriting from the abstract class. A class inheriting an abstract method cannot access the original implementation of the method. In the above example, Method() on class NonAbstractChildClass cannot call Method() on class BaseClass. In this way, an abstract class can force derived classes to provide new method implementations for virtual methods. 207. Can A Sealed Class Be Used As A Base Class? No, sealed class cannot be used as a base class. A compile time error will be generated. 208. What Are The 4 Pillars Of Any Object Oriented Programming Language? 1. Abstraction 2. Inheritance 3. Encapsulation 4. Polymorphism 209. Do Structs Support Inheritance? No, structs do not support inheritance, but they can implement interfaces. 210. What Is The Main Advantage Of Using Inheritance? Code reuse. 211. Does C# Support Multiple Class Inheritance? No, C# supports single class inheritance only. However classes can implement multiple interfaces at the same time. 212. Can A Struct Have A Default Constructor (a Constructor Without Parameters) Or A Destructor In C#? No. 213. Can You Instantiate A Struct Without Using A New Operator In C#? Yes, you can instantiate a struct without using a new operator. 214. Can A Struct Inherit From Another Struct Or Class In C#? No, a struct cannot inherit from another struct or class, and it cannot be the base of a class. 215. Can A Struct Inherit From An Interface In C#? Yes. 216. Are Structs Value Types Or Reference Types? Structs are value types. 217. What Is The Base Type From Which All Structs Inherit Directly? All structs inherit directly from System.ValueType, which inherits from System.Object. 218. What Do You Mean By Saying A "class Is A Reference Type"? A class is a reference type means when an object of the class is created, the variable to which the object is assigned holds only a reference to that memory. When the object reference is assigned to a new variable, the new variable refers to the original object. Changes made through one variable are reflected in the other variable because they both refer to the same data. 219. What Do You Mean By Saying A "struct Is A Value Type"? A struct is a value type mean when a struct is created, the variable to which the struct is assigned holds the struct's actual data. When the struct is assigned to a new variable, it is copied. The new variable and the original variable therefore contain two separate copies of the same data. Changes made to one copy do not affect the other copy. 220. When Do You Generally Use A Class Over A Struct? A class is used to model more complex behavior, or data that is intended to be modified after a class object is created. A struct is best suited for small data structures that contain primarily data that is not intended to be modified after the struct is created. 221. List The 5 Different Access Modifiers In C#? 1. public 2. protected 3. internal 4. protected internal 5. private 222. If You Donot Specify An Access Modifier For A Method, What Is The Default Access Modifier? private. 223. Classes And Structs Support Inheritance. Is This Statement True Or False? False, Only classes support inheritance. structs donot support inheritance. 224. If A Class Derives From Another Class, Will The Derived Class Automatically Contain All The Public, Protected, And Internal Members Of The Base Class? Yes, the derived class will automatically contain all the public, protected, and internal members of the base class except its constructors and destructors. 225. Can You Create An Instance For An Abstract Class? No, you cannot create an instance for an abstract class. 226. How Do You Prevent A Class From Being Inherited By Another Class? Use the sealed keyword to prevent a class from being inherited by another class. 227. Classes And Structs Can Be Declared As Static, Is This Statement True Or False? False, only classes can be declared as static and not structs. 228. Can You Create An Instance Of A Static Class? No, you cannot create an instance of a static class. 229. Can A Static Class Contain Non Static Members? No, a static class can contain only static members. 230. Does C# Support Multiple-inheritance? No, but you can implement more than one interfaces. 231. Who Is A Protected Class-level Variable Available To? It is available to any sub-class (a class inheriting this class). 232. Are Private Class-level Variables Inherited? Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited. 233. Describe The Accessibility Modifier "protected Internal". It is available to classes that are within the same assembly and derived from the specified base class. 234. What's The Top .net Class That Everything Is Derived From? System.Object. 235. What Does The Term Immutable Mean? The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory. 236. What's The Difference Between System.string And System.text.stringbuilder Classes? System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed. 237. What's The .net Collection Class That Allows An Element To Be Accessed Using A Unique Key? HashTable, Dictionary, NameValueCollection. 238. What Class Is Underneath The Sortedlist Class? A sorted HashTable. 239. Will The Finally Block Get Executed If An Exception Has Not Occurred? Yes. Finally block always get executed. 240. What's The C# Syntax To Catch Any Possible Exception? A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}. 241. Can Multiple Catch Blocks Be Executed For A Single Try Statement? No. Once the proper catch block processed, control is transferred to the finally block (if there are any). 242. Explain The Three Services Model Commonly Know As A Three-tier Application. Presentation (UI), Business (logic and underlying code) and Data (from storage or other sources). 243. If A.equals(b) Is True Then A.gethashcode & B.gethashcode Must Always Return Same Hash Code. The answer is False because it is given that A.equals(B) returns true i.e. objects are equal and now its hash Code is asked which is always independent of the fact that whether objects are equal or not. So, Get HashCode for both of the objects returns different value. 244. What Is The Syntax To Inherit From A Class In C#? Place a colon and then the name of the base class. Example: class MyNewClass : MyBaseClass. 245. Can You Prevent Your Class From Being Inherited By Another Class? Yes. The keyword âsealedâ will prevent the class from being inherited. 246. Can You Allow A Class To Be Inherited, But Prevent The Method From Being Over-ridden? Yes. Just leave the class public and make the method sealed. 247. What's An Abstract Class? A class that cannot be instantiated. An abstract class is a class that must be inherited and have the methods overridden. An abstract class is essentially a blueprint for a class without any implementation. 248. When Do You Absolutely Have To Declare A Class As Abstract? 1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden. 2. When at least one of the methods in the class is abstract. 249. What Is An Interface Class? Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes. 250. Why Can't You Specify The Accessibility Modifier For Methods Inside The Interface? They all must be public, and are therefore public by default. 251. Can You Inherit Multiple Interfaces? Yes. .NET does support multiple interfaces. 252. What Happens If You Inherit Multiple Interfaces And They Have Conflicting Method Names? Itâs up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares youâre okay. To Do: Investigate. 253. What's The Difference Between An Interface And Abstract Class? In an interface class, all methods are abstract - there is no implementation. In an abstract class some methods can be concrete. In an interface class, no accessibility modifiers are allowed. An abstract class may have accessibility modifiers. 254. What Is The Difference Between A Struct And A Class? Structs are value-type variables and are thus saved on the stack, additional overhead but faster retrieval. Another difference is that structs cannot inherit. 255. What's The Implicit Name Of The Parameter That Gets Passed Into The Set Method/property Of A Class? Value. The data type of the value parameter is defined by whatever data type the property is declared as. 256. What Does The Keyword "virtual" Declare For A Method Or Property? The method or property can be overridden. 257. How Is Method Overriding Different From Method Overloading? When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class. 258. Can You Declare An Override Method To Be Static If The Original Method Is Not Static? No. The signature of the virtual method must remain the same. (Note: Only the keyword virtual is changed to keyword override) 259. What Are The Different Ways A Method Can Be Overloaded? Different parameter data types, different number of parameters, different order of parameters. 260. If A Base Class Has A Number Of Overloaded Constructors, And An Inheriting Class Has A Number Of Overloaded Constructors; Can You Enforce A Call From An Inherited Constructor To A Specific Base Constructor? Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class. 261. What Does Assert() Method Do? In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true. 262. What's The Difference Between The Debug Class And Trace Class? Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds. 263. What Is The Role Of The Datareader Class In Ado.net Connections? It returns a read-only, forward-only rowset from the data source. A DataReader provides fast access when a forward-only sequential read is needed. 264. What Is The Wildcard Character In Sql? Letâs say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve âLa%â. 265. Between Windows Authentication And Sql Server Authentication, Which One Is Trusted And Which One Is Untrusted? Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction. 266. What Does The Dispose Method Do With The Connection Object? Dispose places the connection backing the managed pool. So that other objects/class can use the connection for further use. 267. How Is The Dll Hell Problem Solved In .net? Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly. 268. What Is A Satellite Assembly? When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies. 269. What Is The Smallest Unit Of Execution In .net? an Assembly. 270. When Should You Call The Garbage Collector In .net? As a good rule, you should not call the garbage collector. However, you could call the garbage collector when you are done using a large object (or set of objects) to force the garbage collector to dispose of those very large objects from memory. However, this is usually not a good practice. 271. How Do You Convert A Value-type To A Reference-type? Use Boxing. 272. What Happens In Memory When You Box And Unbox A Value-type? Boxing converts a value-type to a reference-type, thus storing the object on the heap. Unboxing converts a reference-type to a value-type, thus storing the value on the stack. 273. What's C# ? C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived from C and C++. It also borrows a lot of concepts from Java too including garbage collection. 274. Is It Possible To Inline Assembly Or Il In C# Code? No. 275. Is It Possible To Have Different Access Modifiers On The Get/set Methods Of A Property? No. The access modifier on a property applies to both its get and set accessors. What you need to do if you want them to be different is make the property read-only (by only providing a get accessor) and create a private/internal set method that is separate from the property. 276. Is It Possible To Have A Static Indexer In C#? Allowed In C#. No. Static indexers are not 277. If I Return Out Of A Try/finally In C#, Does The Code In The Finally-clause Run? Yes. The code in the finally always runs. If you return out of the try block, or even if you do a goto out of the try, the finally block always runs: using System; class main { public static void Main() { try { Console.WriteLine(\"In Try block\"); return; } finally { Console.WriteLine(\"In Finally block\"); } } } Both In Try block and In Finally block will be displayed. Whether the return is in the try block or after the try-finally block, performance is not affected either way. The compiler treats it as if the return were outside the try block anyway. If itâs a return without an expression (as it is above), the IL emitted is identical whether the return is inside or outside of the try. If the return has an expression, thereâs an extra store/load of the value of the expression (since it has to be computed within the try block). 278. I Was Trying To Use An Out Int Parameter In One Of My Functions. How Should I Declare The Variable That I Am Passing To It? You should declare the variable as an int, but when you pass it in you must specify it as âoutâ, like the following: int i; foo(out i); where foo is declared as follows: foo(out int o) { } 279. How Does One Compare Strings In C#? In the past, you had to call .ToString() on the strings when using the == or != operators to compare the stringsâ values. That will still work, but the C# compiler now automatically compares the values instead of the references when the == or != operators are used on string types. If you actually do want to compare references, it can be done as follows: if ((object) str1 == (object) str2) { } Hereâs an example showing how string compares work: using System; public class StringTest { public static void Main(string args) { Object nullObj = null; Object realObj = new StringTest(); int i = 10; Console.WriteLine(\"Null Object is \n\" + \"Real Object is \n\" + \"i is \n\"); // Show string equality operators string str1 = \"foo\"; string str2 = \"bar\"; string str3 = \"bar\"; Console.WriteLine(\"{0} == {1} ? {2}\", str1, str2, str1 == str2 ); Console.WriteLine(\"{0} == {1} ? {2}\", str2, str3, str2 == str3 ); } } Output: Null Object is Real Object is i is foo == bar ? False bar == bar ? True 280. How Do You Specify A Custom Attribute For The Entire Assembly (rather Than For A Class)? Global attributes must appear after any top-level using clauses and before the first type or namespace declarations. An example of this is as follows: using System; class X {} Note that in an IDE-created project, by convention, these attributes are placed in AssemblyInfo.cs. 281. How Do You Mark A Method Obsolete? public int Foo() {...} or public int Foo() {...} Note: The O in Obsolete is always capitalized. 282. How Do You Implement Thread Synchronization (object.wait, Notify,and Criticalsection) In C#? You want the lock statement, which is the same as Monitor Enter/Exit: lock(obj) { // code } translates to try { CriticalSection.Enter(obj); // code } finally { CriticalSection.Exit(obj); } 283. How Do You Directly Call A Native Function Exported From A Dll? Hereâs a quick example of the DllImport attribute in action: using System.Runtime.InteropServices; class C { public static extern int MessageBoxA(int h, string m, string c, int type); public static int Main() { return MessageBoxA(0, \"Hello World!\", \"Caption\", 0); } } This example shows the minimum requirements for declaring a C# method that is implemented in a native DLL. The method C.MessageBoxA() is declared with the static and external modifiers, and has the DllImport attribute, which tells the compiler that the implementation comes from the user32.dll, using the default name of Message BoxA. For more information, look at the Platform Invoke tutorial in the documentation. 284. How Do I Simulate Optional Parameters To Com Calls? You must use the Missing class and pass Missing.Value (in System.Reflection) for any values that have optional parameters. 285. What Do You Know About .net Assemblies? Assemblies are the smallest units of versioning and deployment in the .NET application. Assemblies are also the building blocks for programs such as Web services, Windows services, serviced components, and .NET remoting applications. 286. What's The Difference Between Private And Shared Assembly? Private assembly is used inside an application only and does not have to be identified by a strong name. Shared assembly can be used by multiple applications and has to have a strong name. 287. What's A Strong Name? A strong name includes the name of the assembly, version number, culture identity, and a public key token. 288. How Can You Tell The Application To Look For Assemblies At The Locations Other Than Its Own Install? Use the directive in the XML .config file for a given application. should do the trick. Or you can add additional search paths in the Properties box of the deployed application. 289. How Can You Debug Failed Assembly Binds? Use the Assembly Binding Log Viewer (fuslogvw.exe) to find out the paths searched. 290. Where Are Shared Assemblies Stored? Global assembly cache. 291. How Can You Create A Strong Name For A .net Assembly? With the help of Strong Name tool (sn.exe). 292. Where's Global Assembly Cache Located On The System? Usually C:\winnt\assembly or C:\windows\assembly. 293. Can You Have Two Files With The Same File Name In Gac? Yes, remember that GAC is a very special folder, and while normally you would not be able to place two files with the same name into a Windows folder, GAC differentiates by version number as well, so itâs possible for MyApp.dll and MyApp.dll to co-exist in GAC if the first one is version 1.0.0.0 and the second one is 1.1.0.0. 294. So Let's Say I Have An Application That Uses Myapp.dll Assembly, Version 1.0.0.0. There Is A Security Bug In That Assembly, And I Publish The Patch, Issuing It Under Name Myapp.dll 1.1.0.0. How Do I Tell The Client Applications That Are Already Installed To Start Using This New Myapp.dll? Use publisher policy. To configure a publisher policy, use the publisher policy configuration file, which uses a format similar app .config file. But unlike the app .config file, a publisher policy file needs to be compiled into an assembly and placed in the GAC. 295. What Is Delay Signing? Delay signing allows you to place a shared assembly in the GAC by signing the assembly with just the public key. This allows the assembly to be signed with the private key at a later stage, when the development process is complete and the component or assembly is ready to be deployed. This process enables developers to work with shared assemblies as if they were strongly named, and it secures the private key of the signature from being accessed at different stages of development. 296. Is There An Equivalent Of Exit() For Quitting A C# .net Application? Yes, you can use System.Environment.Exit(int exitCode) to exit the application or Application.Exit() if it's a Windows Forms app. 297. Can You Prevent Your Class From Being Inherited And Becoming A Base Class For Some Other Classes? Yes, that is what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It is the same concept as final class in Java. 298. If A Base Class Has A Bunch Of Overloaded Constructors, And An Inherited Class Has Another Bunch Of Overloaded Constructors, Can You Enforce A Call From An Inherited Constructor To An Arbitrary Base Constructor? Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class. 299. I Was Trying To Use An "out Int" Parameter In One Of My Functions. How Should I Declare The Variable That I Am Passing To It? You should declare the variable as an int, but when you pass it in you must specify it as 'out', like the following: int i; foo(out i); where foo is declared as follows: foo(out int o) { } 300. How Do I Make A Dll In C#? You need to use the /target:library compiler option. 301. What Is The C# Equivalent Of C++ Catch (....), Which Was A Catch-all Statement For Any Possible Exception? Does C# Support Try-catch-finally Blocks? Yes. Try-catch-finally blocks are supported by the C# compiler. Here's an example of a try-catch-finally block: using System; public class TryTest { static void Main() { try { Console.WriteLine("In Try block"); throw new ArgumentException(); } catch(ArgumentException n1) { Console.WriteLine("Catch Block"); } finally { Console.WriteLine("Finally Block"); } } } Output: In Try Block Catch Block Finally Block If I return out of a try/finally in C#, does the code in the finally-clause run? Yes. The code in the finally always runs. If you return out of the try block, or even if you do a "goto" out of the try, the finally block always runs, as shown in the following example: using System; class main { public static void Main() { try { Console.WriteLine("In Try block"); return; } finally { Console.WriteLine("In Finally block"); } } } Both "In Try block" and "In Finally block" will be displayed. Whether the return is in the try block or after the try-finally block, performance is not affected either way. The compiler treats it as if the return were outside the try block anyway. If it's a return without an expression (as it is above), the IL emitted is identical whether the return is inside or outside of the try. If the return has an expression, there's an extra store/load of the value of the expression (since it has to be computed within the try block). 302. Is There Regular Expression (regex) Support Available To C# Developers? Yes. The .NET class libraries provide support for regular expressions. Look at the documentation for the System. Text.Regular Expressions namespace. 303. Is There A Way To Force Garbage Collection? Yes. Set all references to null and then call System.GC.Collect(). If you need to have some objects destructed, and System.GC.Collect() doesn't seem to be doing it for you, you can force finalizers to be run by setting all the references to the object to null and then calling System.GC.RunFinalizers(). 304. Does C# Support Properties Of Array Types? Yes. Here's a simple example: using System; class Class1 { private string MyField; public string MyProperty { get { return MyField; } set { MyField = value; } } } class MainClass { public static int Main(string args) { Class1 c = new Class1(); string arr = new string {"apple", "banana"}; c.MyProperty = arr; Console.WriteLine(c.MyProperty); // "apple" return 0; } } 305. How Is Method Overriding Different From Overloading? When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class. 306. When Do You Absolutely Have To Declare A Class As Abstract (as Opposed To Free-willed Educated Choice Or Decision Based On Uml Diagram)? When at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden. 307. Why Would You Use Untrusted Verification? Web Services might use it, as well as non-Windows applications. 308. What Is The Implicit Name Of The Parameter That Gets Passed Into The Class Set Method? Value, and its datatype depends on whatever variable we are changing. 309. How Do I Register My Code For Use By Classic Com Clients? Use the regasm.exe utility to generate a type library (if needed) and the necessary entries in the Windows Registry to make a class available to classic COM clients. Once a class is registered in the Windows Registry with regasm.exe, a COM client can use the class as though it were a COM class. 310. How Do I Do Implement A Trace And Assert? Use a conditional attribute on the method, as shown below: class Debug { public void Trace(string s) { Console.WriteLine(s); } } class MyClass { public static void Main() { Debug.Trace("hello"); } } In this example, the call to Debug.Trace() is made only if the preprocessor symbol TRACE is defined at the call site. You can define preprocessor symbols on the command line by using the /D switch. The restriction on conditional methods is that they must have void return type. 311. How Do I Create A Multi Language, Multi File Assembly? Unfortunately, this is currently not supported in the IDE. To do this from the command line, you must compile your projects into netmodules (/target:module on the C# compiler), and then use the command line tool al.exe (alink) to link these netmodules together. 312. C# Provides A Default Constructor For Me. I Write A Constructor That Takes A String As A Parameter, But Want To Keep The No Parameter One. How Many Constructors Should I Write? Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there is no implementation in. 313. What Is The Equivalent To Regsvr32 And Regsvr32 /u A File In .net Development? Try using RegAsm.exe. The general syntax would be: RegAsm. A good description of RegAsm and its associated switches is located in the .NET SDK docs. Just search on "Assembly Registration Tool".Explain ACID rule of thumb for transactions. Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no in-between case where something has been updated and something hasnot), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system crashes right after). 314. How Do I Create A Multilanguage, Single-file Assembly? This is currently not supported by Visual Studio .NET. 315. Why Cannot You Specify The Accessibility Modifier For Methods Inside The Interface? They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it is public by default. 316. Is It Possible To Restrict The Scope Of A Field/method Of A Class To The Classes In The Same Namespace? There is no way to restrict to a namespace. Namespaces are never units of protection. But if you're using assemblies, you can use the 'internal' access modifier to restrict access to only within the assembly. 317. Why Do I Get A Syntax Error When Trying To Declare A Variable Called Checked? The word checked is a keyword in C#. 318. What Is The Syntax For Calling An Overloaded Constructor Within A Constructor (this() And Constructorname() Does Not Compile)? The syntax for calling another constructor is as follows: class B { B(int i) { } } class C : B { C() : base(5) // call base constructor B(5) { } C(int i) : this() // call C() { } public static void Main() {} } 319. Why Do I Get A "cs5001: Does Not Have An Entry Point Defined" Error When Compiling? The most common problem is that you used a lowercase 'm' when defining the Main method. The correct way to implement the entry point is as follows: class test { static void Main(string args) {} } 320. What Does The Keyword Virtual Mean In The Method Definition? The method can be over-ridden. 321. What Optimizations Does The C# Compiler Perform When You Use The /optimize+ Compiler Option? The following is a response from a developer on the C# compiler team: We get rid of unused locals (i.e., locals that are never read, even if assigned). We get rid of unreachable code. We get rid of try-catch w/ an empty try. We get rid of try-finally w/ an empty try (convert to normal code...). We get rid of try-finally w/ an empty finally (convert to normal code...). We optimize branches over branches: gotoif A, lab1 goto lab2: lab1: turns into: gotoif !A, lab2 lab1: We optimize branches to ret, branches to next instruction, and branches to branches. 322. How Can I Create A Process That Is Running A Supplied Native Executable (e.g., Cmd.exe)? The following code should run the executable and wait for it to exit before continuing: using System; using System.Diagnostics; public class ProcessTest { public static void Main(string args) { Process p = Process.Start(args); p.WaitForExit(); Console.WriteLine(args + " exited."); } } Remember to add a reference to System.Diagnostics.dll when you compile. 323. What Is The Difference Between The System.array.copyto() And System.array.clone()? The first one performs a deep copy of the array, the second one is shallow. 324. How Do I Declare Inout Arguments In C#? The equivalent of inout in C# is ref. , as shown in the following example: public void MyMethod (ref String str1, out String str2) { ... } When calling the method, it would be called like this: String s1; String s2; s1 = "Hello"; MyMethod(ref s1, out s2); Console.WriteLine(s1); Console.WriteLine(s2); Notice that you need to specify ref when declaring the function and calling it. 325. Is There A Way Of Specifying Which Block Or Loop To Break Out Of When Working With Nested Loops? The easiest way is to use goto: using System; class BreakExample { public static void Main(String args) { for(int i=0; i Read the full article
0 notes
Text
300+ TOP AJAX Interview Questions and Answers
AJAX Interview Questions for freshers experienced :-
1. What is Ajax? Ajax is abbreviated as Asynchronous Javascript and XML. It is new technique used to create better, faster and more interactive web systems or applications. Ajax uses asynchronous data transfer between the Browser and the web server. This technique is used to make internet faster and user friendly. It is not a programming language. 2. What are Ajax applications? Browser based applications and platform independent applications are used by Ajax. 3. How many types of triggers are present in update panel? There are two types of triggers used in update panel: PostBackTrigger â This works as full postback and it cannot work asynchronously AsyncPostBackTrigger â Partial post back asynchronously 4. What are all the controls of Ajax? Following are the controls of Ajax: ScriptManager ScriptManagerProxy UpdatePanel UpdateProgress Timer 5. What is the name of the DLL that contains Ajax control tool kit? Ajaxcontroltoolkit.dll is the DLL used for Ajax control tool kit and it can be downloaded from the internet. It can be added in the tool box or copied directly in the bin folder. 6. What role of #&& in querystring? # is treated as fragment delimiter to delimit the history state and && precedes is used to check on the information in the query string. 7. How to control the duration of an Ajax request? AsyncPostBackTimeout property is used to control the duration of Ajax request. Deafult value of this property is 90 seconds. Example â 8. What are the advantages of Ajax? Following are the advantages of Ajax: Bandwidth utilization â It saves memory when the data is fetched from the same page. More interactive Speeder retrieval of data 9. What are the disadvantages of Ajax? Following are the disadvantages of Ajax: AJAX is dependent on Javascript. If there is some Javascript problem with the browser or in the OS, Ajax will not support Ajax can be problematic in Search engines as it uses Javascript for most of its parts. Source code written in AJAX is easily human readable. There will be some security issues in Ajax. Debugging is difficult Increases size of the requests Slow and unreliable network connection. Problem with browser back button when using AJAX enabled pages. 10. What is update panel? Update panel is a server control used to update the specified portion of a web page. Script Manager needs to be used whenever update panel is used. Using update panel, user cannot handle outside controls.
AJAX Interview Questions 11. Which are the two methods used for cross domain Ajax calls? There are two methods used to transfer data between the two more more security domains: CORS â Cross Origin Resource Sharing and it works with the HTTP web browsers JSONP â JSON with Padding which works with the HTTP GET and on legacy browsers 12. What are all the technologies used by Ajax? AJAX uses following technologies: JavaScript XMLHttpRequest Document Object Model (DOM) Extensible HTML (XHTML) Cascading Style Sheets (CSS) 13. What are all the features of Ajax? Following are the features of Ajax and they are as follows: Live data binding Client-side template rendering Declarative instantiation of client components Observer pattern on JavaScript objects and arrays Invoking ADO.NET data services and data contexts DataView control 14. What is JSON in Ajax? JSON is abbreviated as JavaScript Object Notation. JSON is a safe and reliable data interchange format in JavaScript, which is easy to understand for both users and machines. 15. What are the difference between AJAX and Javascript? The differences between AJAX and JavaScript are as follows: AJAX sends request to the server and does not wait for the response. It performs other operations on the page during that time. Whereas, JavaScript makes a request to the server and waits for response. AJAX does not require the page to refresh for downloading the whole page, whereas JavaScript manages and controls a Web page after being downloaded. AJAX minimizes the overload on the server since the script needs to request once, while JavaScript posts a request that updates the script every time. AJAX is an approach towards page reloading, while JavaScript is a way to incorporate content on the webpage. AJAX allows the coder to send a request for data asynchronously in order to load new data without changing the web page. JavaScript allows the creation of dynamic webpages by providing a new level of interactivity. AJAX supports the server side scripting language, whereas JavaScript supports the client side scripting language. AJAX can load a webpage after it has been loaded for the first time. Whereas, JavaScript cannot reload the page after it is loaded. AJAX cannot be used to install a Trojan in the computer, while JavaScript can be used. 16. What are the components of the ASP.NET AJAX architecture? There are two components of AJAX Architecture: AJAX client architecture AJAX server architecture 17. What are the extender controls? The extender controls uses a block of JavaScript code to add new and enhanced capabilities to ASP.NET. 18. What is AJAX Control Extender Toolkit? AJAX Control Toolkit is one of the extenders that are used to extend or add the functionalities of the ASP.NET controls. The extenders use a block of JavaScript code to add new and enhanced capabilities to the ASP.NET controls. AJAX Control Extender Toolkit is a free download from site. 19. Where AJAX cannot be used? Users cannot use AJAX if If Page need to show in a search engine If browser does not support JavaScript If user wants to create secure application 20. What are the pre-requisites to execute AJAX applications on a server? AJAX is a built-in functionality of .NET Framework 4.0 and AJAX application can be executed by just installing Microsoft Visual Studio 2010. To use extenders in your applications, you are required to install AJAX Control Toolkit and copy the AjaxControlToolkit.dll file to the Bin directory of your application. 21. What is AJAX Framework? ASP.NET AJAX is a free framework to implement Ajax in asp.net web applications. It is used to quickly creating efficient and interactive Web applications that work across all browsers. 22. How can you find out that an AJAX request has been completed? ReadyState property is used to check whether AJAX request has been completed. If the property is equal to four, then the request has been completed and data is available. 23. Is javascript knowledge is required to do Ajax? Yes, if you plan to develop new AJAX functionality for your web application. 24. What are all the browsers support AJAX? Following browsers support AJAX: Internet Explorer 5.0 and above Opera 7.6 and above Netscape 7.1 and above Safari 1.2 and above 25. How can you test the Ajax code? JSUnit is the client side javascript code used as part of JUnit. JSUnit has been used for Ajax code. 26. Is Ajax said to be a technology platform or is it an architectural style? Ajax supports both technology and as architectural style. 27. How can AJAX applications be debugged? Two tools are used for debugging: Fiddler for IE Firebug for Mozilla. 28. How can we cancel the XMLHttpRequest in AJAX? Abort() method can be called to cancel the XMLHttpRequest in Ajax. 29. Is AJAX code cross browser compatible? No, it is supporting cross browser compatible. If the browsers supports native XMLHttpRequest JavaScript object, then this can be used. 30. What is the name of object used for AJAX request? XmlHttpRequest object is used for Ajax requests. 31. What is prerequisite for Update Panel in Ajax? Script Manager is pre-requisite to use Update Panel controls. 32. How many update panel can be used per page? There are no restrictions on the number of update panels per page. 33. What is Script Manager? Script Manager helps manage the client side script of AJAX. Script Manager acts as a mediator as AJAX depends on JavaScript. Every page that uses AJAX has a Script Manager to enable AJAX libraries. 34. How Ajax objects can be created? Following syntax can be used to create Ajax objects: Var sample = New ajaxObject(âpath of the pageâ) 35. What are the protocols used by Ajax? HTTPâs GET or POST XMLHttpRequest for placing a request with the web server Uses JSON to communicate between the client and server UED or URL encoded data 36. What are all the security issues of Ajax? Security issues that can be encountered When Ajax calls are sent through plain text and it may lead to know the database details Inserting scripts can also be possible and attackers can easily penetrate into the system 37. How can we handle concurrent requests? Javascript functions should be written to handle concurrent requests and call back function can be passed as a parameter. Those parameters are passed to AjaxInteraction(URL, callback) object. 38. Define the role of the Update Panel? Update Panel is used to add functionality to the existing ASP.NET applications. By using partial page rendering, it can be used to update the content. Refresh can be made for the partial page instead of whole page. 39. Can we use nested update panel in Ajax? Yes, we can use nested update panel in Ajax. Update panels can be nested to have more control over the Page Refresh. 40. What are the types of post back in Ajax? There are two types of post backs: Synchronous Postback Asynchronous Postback 41. How can we handle exception handling in Ajax? ErrorTemplate which is the child tag of Script Manager is used to handle exception handling in Ajax. 42. What are the components of the ASP.NET Ajax Client Library? Following components are used in Ajax client library: Component Layer Core Services Layer Browser Compatibility Layer 43. What are the controls of the Script Management group? The controls of script Management group are: ScriptManager ScriptManagerProxy 44. What are all the different data types that JSON supports? JSON supports following data types: String Number Boolean Array Object Null 45. What are the goals of Ajax? The basic goals of ASP.NET Ajax are: Reduced web server hits Reduced Network load Interactive user interface Platform and architecture neutrality Support for both synchronous and asynchronous communication Provide a server- and client-side framework 46. What is the difference between proxied and proxyless calls in AJAX? Proxied calls are made through stub objects which can be called from PHP classes on the JavaScript side in AJAX. Proxyless calls are made using utility JavaScript functions like HTML_AJAX.replace() and HTML_AJAX.append() in AJAX. 47. How many types of ready states in Ajax? There are four ready states in Ajax: Initialization Request Process Ready 48. What is the difference between RegisterClientScriptBlock, RegisterClientScriptInclude and RegisterClientScriptResource? Following are the functions: RegisterClientScriptBlock â The script is specified as a string parameter. RegisterClientScriptInclude â By setting the source attribute to a URL that point to a script file. RegisterClientScriptResource â specifies Resource name in an assembly. The source attribute is automatically populated with a URL by a call to an HTTP handler that retrieves the named script from the assembly. 49. Which request is better, Get or Post? AJAX requests should use an HTTP GET request where the data does not change for a given URL requested. An HTTP POST should be used when state is updated on the server. This is highly recommended for a consistent web application architecture. 50. What are the limitations of Ajax? An Ajax Web Application tends to confuse end users if the network bandwidth is slow and there is no full postback running. 51. What Kinds Of Applications Is Ajax Best Suited For? We donât know yet. Because this is a relatively new approach, our understanding of where Ajax can best be applied is still in its infancy. Sometimes the traditional web application model is the most appropriate solution to a problem. 52. Does This Mean Adaptive Path Is Anti-flash? Not at all. Macromedia is an Adaptive Path client, and weâve long been supporters of Flash technology. As Ajax matures, we expect that sometimes Ajax will be the better solution to a particular problem, and sometimes Flash will be the better solution. Weâre also interested in exploring ways the technologies can be mixed (as in the case of Flickr, which uses both). 53. Where Can I Find Examples Of Ajax? While components of AJAX have been around for some time (for instance, 1999 for XMLHttpRequest), it really didn't become that popular until Google took. But Global Guide Line guide all of its viewers to learn AJAX from absolute beginner to advance level. 54. What Is The Xmlhttprequest Object? It offers a non-blocking way for JavaScript to communicate back to the web server to update only part of the web page. 55. Does Ajax Have Significant Accessibility Or Browser Compatibility Limitations? Do Ajax Applications Break The Back Button? Is Ajax Compatible With Rest? Are There Security Considerations With Ajax Development? Can Ajax Applications Be Made To Work For Users Who Have Javascript Turned Off? The answer to all of these questions is âmaybeâ. Many developers are already working on ways to address these concerns. We think thereâs more work to be done to determine all the limitations of Ajax, and we expect the Ajax development community to uncover more issues like these along the way. 56. How Do I Access Data From Other Domains To Create A Mashup With Java? From your JavaScript clients you can access data in other domains if the return data is provide in JSON format. In essence you can create a JavaScript client that runs operates using data from a different server. This technique is know as JSON with Padding or JSONP. There are questions as to whether this method is secure as you are retrieving data from outside your domain and allowing it to be excuted in the context of your domain. Not all data from third parties is accessible as JSON and in some cases you may want an extra level of protection. With Java you can provide a proxy to third party services using a web component such as a servlet. This proxy can manage the communication with a third party service and provide the data to your clients in a format of your choosing. You can also cache data at your proxy and reduce trips to service. For more on using a Java proxy to create mashups see The XmlHttpProxy Client for Java. 57. Does Java Have Support For Comet Style Server-side Push? Current AJAX applications use polling to communicate changes data between the server and client. Some applications, such as chat applications, stock tickers, or score boards require more immediate notifications of updates to the client. Comet is an event based low latency server side push for AJAX applications. Comet communication keeps one of the two connections available to the browser open to continuously communicate events from the server to the client. A Java based solution for Comet is being developed for Glassfish on top of the Grizzly HTTP connector. See Enabling Grizzly by Jean-Francois Arcand for more details. 58. How Do We Create A Thread To Do Ajax Polling? JavaScript does not have threads. JavaScript functions are called when an event happens in a page such as the page is loaded, a mouse click, or a form element gains focus. You can create a timer using the set Timeout which takes a function name and time in milliseconds as arguments. You can then loop by calling the same function as can be seen in the JavaScript example below. function checkForMessage() { // start AJAX interaction with processCallback as the callback function } // callback for the request function processCallback() { // do post processing setTimeout("checkForMessage()", 10000); } Notice that the checkForMessage will continue to loop indefinitely. You may want to vary the increment the interval based on activity in the page or your use cases. You may also choose to have logic that would break out of the loop based on some AJAX response processing condition. 59. Is The Xmlhttprequest Object Part Of A W3c Standard? No. Or not yet. It is part of the DOM Level 3 Load and Save Specification proposal. 60. How Does One Call A Javascript Function From The Ajax Code? Ajax is a form of JavaScript, which uses XML Http Request objects that take action event parameters into a method called âopenâ. The term AJAX symbolizes Asynchronous Java script and XML, wherein there is no order in which the requests and responses are tracked.âXMLHttpRequest.openâ takes action events as URL Parameters. On the other hand, âXMLHttp Request.sendâ sends the Request object either asynchronously or synchronously, depending on whether the option for the synchronous version is true or false. 61. Can You List Some Examples Of Ajax-based Applications? Some applications and scenarios in which AJAX is utilized include login forms, auto-complete (e,g. Google search ), voting and rating systems, updating with user content, form submission and validation, chat rooms and instant messaging, Slicker UIs, external widgets, light-boxes (as opposed to pop-ups), and Flash (e.g. Flash games). 62. Is Ajax A Browser-dependent Or A Browser-independent Script? AJAX is a browser-dependent technology. The Ajax engine runs on Firefox, Opera 8, Safari and later Mozilla builds, and the Microsoft ActiveX object. 63. What is asynchronous request in AJAX? In an asynchronous request, the page continues to work normally without blocking the user. It is the most preferred way of sending a request. 64. Does Load Runner Support Ajax Apps? Load Runner supports AJAX Apps. However, Ajax protocols in Load Runner are not as efficient as they are in HTTP. Yet, using HTTP to record AJAX web requires copious custom coding. AJAX protocols heavily depend on memory, and running more than 2GB of ram could cause the machine to freeze. 65. Describe The Process And Benefits Of Using The Always Visible Control Extender? The Always Visible Control Extender authorizes a control to be pinned to a particular location. For example, when a control has been permanently set to be present at the left corner of the page, the control will be so in the prescribed left and right co-ordinates. This placement will apply, whenever the page is resized or scrolled. 66. What Are Synchronous And Asynchronous Ajax Requests? During the initiation of synchronous requests, the script desists and awaits a reply from the server before proceeding; but during the initiation of asynchronous requests, the script sanctions the procession of the page and handles the reply. 67. How We Can Send More Values Through The Response Text? We can send text values with the concatenation of âIâ operator and by splitting with the pipe operator like âresponseText.split(â|â);â If done properly, we would receive an array of our text. Now, we can access it, or we can use JSQN to send multiple text values in a array format. 68. What Is The Predominant Distinction Between Javascript And J-query? JavaScript is a language, while j-query is merely a library written using JavaScript. This library is light-weight, cross-browser compatible, and simple. One can also assert that j-query is a plugin used to build function. 69. When Should We Use A Java Applet Instead Of Ajax? Many amazing things can be done with AJAX/DHTML, but there are limitations. AJAX and applets can be used together in the same UIs, with AJAX providing the basic structure and applets providing more advanced functionality. The java applet can communicate to JavaScript using the Live-Connect APIs. One should not ask: âshould we use AJAX or applets?â Instead, one should discover which technology best fits your needs. In summary, AJAX and applets need not be mutually exclusive. 70. What Is The Difference Between A Destructor And A Garbage Collector? A destructor is a special member function of a class called as soon as an object is de-allocated, while a garbage collector is either a program or an application that de-allocates the memory of a formerly unreachable object. 71. Do Ajax Applications Always Deliver A Better Experience Than That Delivered By A Traditional Web Application? AJAX gives interaction designers more flexibility. However, the more power we have, the more caution we must use in exercising it. We must be careful to use AJAX only to enhance the user experience of our applications. 72. How Do We Manage Concurrent Request? For managing concurrent request we can write a function or we can use Java Script closures. After code processing is finishes the call back function and the URL would pass as parameters, they are passed to the object (Ajax Interaction). These closures are good in the way that they insure the right callback function will be invoked and this will have a particular Ajax Interaction. 73. Which Are The Problems That Can Be Fixed Using Ajax And What Is The Actual Meaning Of Ajax? The technologies that represent Ajax belong to the client and they make possible an asynchronous client to server communication. When synchronous communication is involved at every event a complete round trip takes place, issue solved by using asynchronous communication. 74. Is There Any Use Abilities Problems In Ajax? The appearance of a page is changed very much when we used Ajax interaction to dynamically update it. Because of the dynamically changes, also the state of the page is modify and the page behavior has to be defined for the following actions :navigation, using back , slash forward, page bookmarks, URL sharing, time dependant , printing of pages. Navigation-we have to define page refreshing, back and forward and so on .For simplifying navigation we can use a Java Script framework like Dojo. For bookmarking or URL sharing we have Dojo. Printing-problems may appear when the rendered pages are printed dynamically. 75. Which Are The Knowledge Requirements For Personal Ajax Functionality? To make a personal Ajax component and not reuse an already made one we need to have knowledge of the following: Learning of DHTML or Dynamic HTML is a must because this is the Ajax foundation; it enables a high level of interaction in the browsers between users and pages. CSS, Document Object Model and Java Script form together what is called DHTML. We must also learn JavaScript which is an object based language compatible with the majority of browsers and very important for the interactions of Ajax, JavaScript is invoked on mouse clicks, page boots pr completing various form. Document Object Model or DOM is an application used for handling structured documents usually with HTML or XML documents. CSS-gives us the possibility to dyne the appearance(fonts, sizes, colors, positions it).In addition to these we must also known about the requestresponse behavior of HTTP, because ignoring some of the things involved can load to serious bugs. 76. Which Are The Trigger Types That We Find In Update Panel? The types or triggers are in member of two: PostBackTrigger and AsynPostBackTrigger. The first one makes a complete postback. It doesnât work asynchronously, the second one makes a practical postback and this is working asynchronously. 77. How Can Javascript Be Debugged? Right now the number of utilities that are compatible with both client and server debugging is small, but this could change over time. The debugging is currently made in separate way. Some of the client debuggers for some popular browsers are presented below: the Venkman debugger is a built-in feature of Netscape/Mozilla browser and also there is an add-on called FireBug, also the browser Safari has a similar debugger that can be used by activation and Internet Explorer has some methods of debugging JavaScript. A common method used by debuggers is âAlert Debuggingâ with the function âalert( )â. 78. What Are The Protocols And Forms In Ajax? XMLHttpRequest, this protocol is meant for doing requests to a server. The client browser makes an object, the transfer of data happens in JSON or plain text. The JSON format can be parsed by java script and will be compatible with every browser. 79. Do We Have To Use Http Get/post For The Ajax Calls? If the data doesnât change for a particular request URL, HTTP GET requests are necessary. If the state on a server is going to be updated then a HTTP POST is necessary. 80. Easy Trough That The Classical Web Applications Are Harder To Make Than Ajax Applications? Not really, because the code that has to run on the client is complicated and it is hard to create such a code, without having bugs and we need the aid of many tools of an efficient code. 81. Why Is Html_ajax Having Stability Issues On Some Installations? If the problem that we have with is specific to certain servers the best explanation would be that the problem relates to output compression. It can be dictated and fixed PHP config but if it is a related apache extension it is almost impossible to be detected properly. In most cases we will have to disable the AJAX extension, but in rare cases we can fix the issue by using the setting sendContentLength to false. Also xDdebug can create some issues but they can be fixed by the activating the extension. 82. Is It True That Ajax Is Code Browser Compatible? Yes but only partially. The majority of browsers give us a built-in XMLHttpRequest JavaScript object but some, like Internet Explorer, will asked it in the form of an ActiveX object. 83. Is It True That A Xmlhttprequest Objects Belongs To The W3c Standard? This hasnât been decided until now but we know just that it belongs to DOM Level 3 Load and Save. 84. What Meaning Has Asp.net Ajax? ASP .NET Ajax is developed by Microsoft and it represent the free Ajax frame work used for creating applications that have a great amount of interactivity and is compatible with all the browsers. It gives us the possibility to choose our own way of using Ajax no matter if is Server-side, Client-side, the Query library or the Ajax Control Tool kit. 85. What Are The Browser Versions That Ajax Is Compatible With? From the version 0.3.0 Ajax is compatible with Internet Explorer 5.5, Mozilla Firefox 1.0, Safari 2+ and Opera 8.5+. 86. In What Way Are Proxyless Calls Different Than The Proxied Calls In Ajax? Proxyless calls can be possible using functions such as HTML_AJAX.replace() or HTML_AJAX.append(). This functions are JavaScript utilities. Proxied calls are possible by using limitations of PHP classes or stub objects in JavaScript. 87. How Can We Make A Mashup With Java By Accessing Other Domains Data? We can gain access to other domains data in our Java Script clients if the format of the data returned is in JSON format. In this way JavaScript client can be made which is running with the usage of another servers data, method called JSQN with Padding (JSQNP). This method has his doubts when it comes to security, because it functions by bringing data from outside our domain, but the execution is made inside. Not every type of data from outside can be accessed as JSON and sometimes we want more security. In Java a proxy can be given to outside services with the aid of what we called a servlet, which is used for communication management between outside and inside services and gives us the possibility of changing the format of the data we provide according to our wishes. For speed improvement data can be cached. 88. Does Ajax Have The Same Meaning As Xmlhttprequest? Because XMLHttpRequest is just a piece of Ajax, the answer will be no. Ajax depends on many pieces like XMLHttpRequest, CSS, DOM, etc. XMLHttpRequest is the part responsible for asynchronous server communication. 89. In Ajax Does The Client Or The Sever Have The Control? Sometimes yes, sometimes no. It can be more like a server-side centralized component or controller or client-side controller. A centralized server-side controller is the case where we must assure that the client-side page data is synchronized with the server data. Many programs are preserving everything on the server and the updates are given to the client DOM through an easy Java Script controller. The case of client and server-side controllers uses a JavaScript for making each control that relates to presentation, each processing of events, each manipulation of pages and model data rendering on the client. The responsibility of business logic or giving the updated model data to a client is taken by the server-side. But this case doesnât include specific information about the initial pages which is sent to the request of the client page. In certain use cases the whole Ajax application is possible to write in one page. If we chose this we must also remember about bookmarking and navigation. 90. We Used Asynchronous Server Communication For A Long Time, What New Thing Is Ajax Bringing? Ajax is bringing changes in the way we use interactive real-world web applications. Now itâs time to apply all this new technologies that have been in development for many years. 91. Is It True That The Ajax Application Are Much Better Than The Classical Internet Applications? Not really. What it is true is that Ajax has brought more flexibility. This flexibility also implies a higher degree of responsibility when we use Ajax for providing a better experience for the user. 92. What Is The Response Time When Using Ajax? Response time can also be named latency and it means the period of time that passes from the beginning of a request processing by the client to the sever until its end. Id the time is longer than normal then we say we had a delay, Delays usually appear when the XMLHttpRequest object is badly handled. 93. Which Is The Purpose For Using The Scriptmanager? ScriptManager is used for handling every ASP.NET Ajax resource and it makes links for the client libraries in ASP.NET Ajax. This means we will be able to use UpdatePanels, PageMethods and others. Also the page request Manager and Application objects are made, they are important in the client life cycle for raising events in the ASP.NET Ajax web pages. It is also good for making proxies for calling web services asynchronously. 94. What Is The Use Of Updatepanel? Updatepanel gives us the possibility to make ASP .NET applications Ajax compatible, to update the content of a page with the aid of Partial-Page rendering. This is useful for refreshing a section of the page without refreshing the entire page. 95. What is the full form of AJAX? AJAX stands for Asynchronous JavaScript and XML. 96. How can you debug AJAX application? If you want to debug in Google Chrome, then use Chrome Developer Tool. On Mozilla Firefox, with the help of Firebug, debugging can be done easily. 97. Can you provide any real world example of AJAX? Nowadays, many websites and web applications are using AJAX. Some of the most popular web applications are- Google Maps Youtube Instagram Google Plus Twitter Facebook 98. What are disadvantages of AJAX? Every technology is not a perfect and has some disadvantages. The cons of AJAX are- Source code of AJAX is viewable. It depends on javascript and cannot work if javascript is disabled in a web browser. Malicious code can be inserted into the system. 99. What is Rich Internet Application (RIA)? An application that works similar to a desktop application and has enhanced the user interface, advanced functions and quicker response time. 100. What are the most popular AJAX framework? Angular JS Backbone.js Prototype Ext JS jQuery and jQuery UI AJAX Questions and Answers Pdf Download Read the full article
0 notes
Link
#Most Asked ASP.NET MVC Interview Questions and Answers#TOP 50 ASP.NET MVC Interview Questions with Answers#15 Essential ASP.NET MVC Interview Questions and Answers#MVC Interview Question#ASP.NET MVC Interview Questions#Top 31 MVC Interview Questions & Answers#ASP.NET MVC interview questions with answers#10 Essential Asp.Net MVC Interview Questions Updated For 2019#MVC ASP.NET Interview Question#MVC ASP.NET questions#MVC ASP.NET#MVC ASP.NET Questions For interview#Best MVC ASP.NET interview Questions#MVC ASP.NET interview Questions For Freshers#MVC ASP.NET interview questions for experienced#MVC ASP.NET mock test questions for freshers#MVC ASP.NET mock test questions for experienced#most common MVC ASP.NET interview questions#Top 20 MVC ASP.NET interview questions#Top 50 MVC ASP.NET interview questions#asp.net mvc interview questions and answers for 4 years experience#asp.net mvc interview questions pdf#mvc interview questions#asp.net mvc tough interview questions#mvc interview questions for 7 years experience
0 notes
Link
List of Top 20 Most Asked ASP.NET MVC Interview Questions like, What is Data Annotations in ASP.NET MVC, Scaffolding Techniques, Url Helpers, Razor View Engine, Difference Between Routing and URL Rewriting, Routing in ASP.NET MVC. When to use _ViewStart & Many More
0 notes
Text
300+ TOP AJAX Interview Questions and Answers
AJAX Interview Questions for freshers experienced :-
1. What is Ajax? Ajax is abbreviated as Asynchronous Javascript and XML. It is new technique used to create better, faster and more interactive web systems or applications. Ajax uses asynchronous data transfer between the Browser and the web server. This technique is used to make internet faster and user friendly. It is not a programming language. 2. What are Ajax applications? Browser based applications and platform independent applications are used by Ajax. 3. How many types of triggers are present in update panel? There are two types of triggers used in update panel: PostBackTrigger â This works as full postback and it cannot work asynchronously AsyncPostBackTrigger â Partial post back asynchronously 4. What are all the controls of Ajax? Following are the controls of Ajax: ScriptManager ScriptManagerProxy UpdatePanel UpdateProgress Timer 5. What is the name of the DLL that contains Ajax control tool kit? Ajaxcontroltoolkit.dll is the DLL used for Ajax control tool kit and it can be downloaded from the internet. It can be added in the tool box or copied directly in the bin folder. 6. What role of #&& in querystring? # is treated as fragment delimiter to delimit the history state and && precedes is used to check on the information in the query string. 7. How to control the duration of an Ajax request? AsyncPostBackTimeout property is used to control the duration of Ajax request. Deafult value of this property is 90 seconds. Example â 8. What are the advantages of Ajax? Following are the advantages of Ajax: Bandwidth utilization â It saves memory when the data is fetched from the same page. More interactive Speeder retrieval of data 9. What are the disadvantages of Ajax? Following are the disadvantages of Ajax: AJAX is dependent on Javascript. If there is some Javascript problem with the browser or in the OS, Ajax will not support Ajax can be problematic in Search engines as it uses Javascript for most of its parts. Source code written in AJAX is easily human readable. There will be some security issues in Ajax. Debugging is difficult Increases size of the requests Slow and unreliable network connection. Problem with browser back button when using AJAX enabled pages. 10. What is update panel? Update panel is a server control used to update the specified portion of a web page. Script Manager needs to be used whenever update panel is used. Using update panel, user cannot handle outside controls.
AJAX Interview Questions 11. Which are the two methods used for cross domain Ajax calls? There are two methods used to transfer data between the two more more security domains: CORS â Cross Origin Resource Sharing and it works with the HTTP web browsers JSONP â JSON with Padding which works with the HTTP GET and on legacy browsers 12. What are all the technologies used by Ajax? AJAX uses following technologies: JavaScript XMLHttpRequest Document Object Model (DOM) Extensible HTML (XHTML) Cascading Style Sheets (CSS) 13. What are all the features of Ajax? Following are the features of Ajax and they are as follows: Live data binding Client-side template rendering Declarative instantiation of client components Observer pattern on JavaScript objects and arrays Invoking ADO.NET data services and data contexts DataView control 14. What is JSON in Ajax? JSON is abbreviated as JavaScript Object Notation. JSON is a safe and reliable data interchange format in JavaScript, which is easy to understand for both users and machines. 15. What are the difference between AJAX and Javascript? The differences between AJAX and JavaScript are as follows: AJAX sends request to the server and does not wait for the response. It performs other operations on the page during that time. Whereas, JavaScript makes a request to the server and waits for response. AJAX does not require the page to refresh for downloading the whole page, whereas JavaScript manages and controls a Web page after being downloaded. AJAX minimizes the overload on the server since the script needs to request once, while JavaScript posts a request that updates the script every time. AJAX is an approach towards page reloading, while JavaScript is a way to incorporate content on the webpage. AJAX allows the coder to send a request for data asynchronously in order to load new data without changing the web page. JavaScript allows the creation of dynamic webpages by providing a new level of interactivity. AJAX supports the server side scripting language, whereas JavaScript supports the client side scripting language. AJAX can load a webpage after it has been loaded for the first time. Whereas, JavaScript cannot reload the page after it is loaded. AJAX cannot be used to install a Trojan in the computer, while JavaScript can be used. 16. What are the components of the ASP.NET AJAX architecture? There are two components of AJAX Architecture: AJAX client architecture AJAX server architecture 17. What are the extender controls? The extender controls uses a block of JavaScript code to add new and enhanced capabilities to ASP.NET. 18. What is AJAX Control Extender Toolkit? AJAX Control Toolkit is one of the extenders that are used to extend or add the functionalities of the ASP.NET controls. The extenders use a block of JavaScript code to add new and enhanced capabilities to the ASP.NET controls. AJAX Control Extender Toolkit is a free download from site. 19. Where AJAX cannot be used? Users cannot use AJAX if If Page need to show in a search engine If browser does not support JavaScript If user wants to create secure application 20. What are the pre-requisites to execute AJAX applications on a server? AJAX is a built-in functionality of .NET Framework 4.0 and AJAX application can be executed by just installing Microsoft Visual Studio 2010. To use extenders in your applications, you are required to install AJAX Control Toolkit and copy the AjaxControlToolkit.dll file to the Bin directory of your application. 21. What is AJAX Framework? ASP.NET AJAX is a free framework to implement Ajax in asp.net web applications. It is used to quickly creating efficient and interactive Web applications that work across all browsers. 22. How can you find out that an AJAX request has been completed? ReadyState property is used to check whether AJAX request has been completed. If the property is equal to four, then the request has been completed and data is available. 23. Is javascript knowledge is required to do Ajax? Yes, if you plan to develop new AJAX functionality for your web application. 24. What are all the browsers support AJAX? Following browsers support AJAX: Internet Explorer 5.0 and above Opera 7.6 and above Netscape 7.1 and above Safari 1.2 and above 25. How can you test the Ajax code? JSUnit is the client side javascript code used as part of JUnit. JSUnit has been used for Ajax code. 26. Is Ajax said to be a technology platform or is it an architectural style? Ajax supports both technology and as architectural style. 27. How can AJAX applications be debugged? Two tools are used for debugging: Fiddler for IE Firebug for Mozilla. 28. How can we cancel the XMLHttpRequest in AJAX? Abort() method can be called to cancel the XMLHttpRequest in Ajax. 29. Is AJAX code cross browser compatible? No, it is supporting cross browser compatible. If the browsers supports native XMLHttpRequest JavaScript object, then this can be used. 30. What is the name of object used for AJAX request? XmlHttpRequest object is used for Ajax requests. 31. What is prerequisite for Update Panel in Ajax? Script Manager is pre-requisite to use Update Panel controls. 32. How many update panel can be used per page? There are no restrictions on the number of update panels per page. 33. What is Script Manager? Script Manager helps manage the client side script of AJAX. Script Manager acts as a mediator as AJAX depends on JavaScript. Every page that uses AJAX has a Script Manager to enable AJAX libraries. 34. How Ajax objects can be created? Following syntax can be used to create Ajax objects: Var sample = New ajaxObject(âpath of the pageâ) 35. What are the protocols used by Ajax? HTTPâs GET or POST XMLHttpRequest for placing a request with the web server Uses JSON to communicate between the client and server UED or URL encoded data 36. What are all the security issues of Ajax? Security issues that can be encountered When Ajax calls are sent through plain text and it may lead to know the database details Inserting scripts can also be possible and attackers can easily penetrate into the system 37. How can we handle concurrent requests? Javascript functions should be written to handle concurrent requests and call back function can be passed as a parameter. Those parameters are passed to AjaxInteraction(URL, callback) object. 38. Define the role of the Update Panel? Update Panel is used to add functionality to the existing ASP.NET applications. By using partial page rendering, it can be used to update the content. Refresh can be made for the partial page instead of whole page. 39. Can we use nested update panel in Ajax? Yes, we can use nested update panel in Ajax. Update panels can be nested to have more control over the Page Refresh. 40. What are the types of post back in Ajax? There are two types of post backs: Synchronous Postback Asynchronous Postback 41. How can we handle exception handling in Ajax? ErrorTemplate which is the child tag of Script Manager is used to handle exception handling in Ajax. 42. What are the components of the ASP.NET Ajax Client Library? Following components are used in Ajax client library: Component Layer Core Services Layer Browser Compatibility Layer 43. What are the controls of the Script Management group? The controls of script Management group are: ScriptManager ScriptManagerProxy 44. What are all the different data types that JSON supports? JSON supports following data types: String Number Boolean Array Object Null 45. What are the goals of Ajax? The basic goals of ASP.NET Ajax are: Reduced web server hits Reduced Network load Interactive user interface Platform and architecture neutrality Support for both synchronous and asynchronous communication Provide a server- and client-side framework 46. What is the difference between proxied and proxyless calls in AJAX? Proxied calls are made through stub objects which can be called from PHP classes on the JavaScript side in AJAX. Proxyless calls are made using utility JavaScript functions like HTML_AJAX.replace() and HTML_AJAX.append() in AJAX. 47. How many types of ready states in Ajax? There are four ready states in Ajax: Initialization Request Process Ready 48. What is the difference between RegisterClientScriptBlock, RegisterClientScriptInclude and RegisterClientScriptResource? Following are the functions: RegisterClientScriptBlock â The script is specified as a string parameter. RegisterClientScriptInclude â By setting the source attribute to a URL that point to a script file. RegisterClientScriptResource â specifies Resource name in an assembly. The source attribute is automatically populated with a URL by a call to an HTTP handler that retrieves the named script from the assembly. 49. Which request is better, Get or Post? AJAX requests should use an HTTP GET request where the data does not change for a given URL requested. An HTTP POST should be used when state is updated on the server. This is highly recommended for a consistent web application architecture. 50. What are the limitations of Ajax? An Ajax Web Application tends to confuse end users if the network bandwidth is slow and there is no full postback running. 51. What Kinds Of Applications Is Ajax Best Suited For? We donât know yet. Because this is a relatively new approach, our understanding of where Ajax can best be applied is still in its infancy. Sometimes the traditional web application model is the most appropriate solution to a problem. 52. Does This Mean Adaptive Path Is Anti-flash? Not at all. Macromedia is an Adaptive Path client, and weâve long been supporters of Flash technology. As Ajax matures, we expect that sometimes Ajax will be the better solution to a particular problem, and sometimes Flash will be the better solution. Weâre also interested in exploring ways the technologies can be mixed (as in the case of Flickr, which uses both). 53. Where Can I Find Examples Of Ajax? While components of AJAX have been around for some time (for instance, 1999 for XMLHttpRequest), it really didn't become that popular until Google took. But Global Guide Line guide all of its viewers to learn AJAX from absolute beginner to advance level. 54. What Is The Xmlhttprequest Object? It offers a non-blocking way for JavaScript to communicate back to the web server to update only part of the web page. 55. Does Ajax Have Significant Accessibility Or Browser Compatibility Limitations? Do Ajax Applications Break The Back Button? Is Ajax Compatible With Rest? Are There Security Considerations With Ajax Development? Can Ajax Applications Be Made To Work For Users Who Have Javascript Turned Off? The answer to all of these questions is âmaybeâ. Many developers are already working on ways to address these concerns. We think thereâs more work to be done to determine all the limitations of Ajax, and we expect the Ajax development community to uncover more issues like these along the way. 56. How Do I Access Data From Other Domains To Create A Mashup With Java? From your JavaScript clients you can access data in other domains if the return data is provide in JSON format. In essence you can create a JavaScript client that runs operates using data from a different server. This technique is know as JSON with Padding or JSONP. There are questions as to whether this method is secure as you are retrieving data from outside your domain and allowing it to be excuted in the context of your domain. Not all data from third parties is accessible as JSON and in some cases you may want an extra level of protection. With Java you can provide a proxy to third party services using a web component such as a servlet. This proxy can manage the communication with a third party service and provide the data to your clients in a format of your choosing. You can also cache data at your proxy and reduce trips to service. For more on using a Java proxy to create mashups see The XmlHttpProxy Client for Java. 57. Does Java Have Support For Comet Style Server-side Push? Current AJAX applications use polling to communicate changes data between the server and client. Some applications, such as chat applications, stock tickers, or score boards require more immediate notifications of updates to the client. Comet is an event based low latency server side push for AJAX applications. Comet communication keeps one of the two connections available to the browser open to continuously communicate events from the server to the client. A Java based solution for Comet is being developed for Glassfish on top of the Grizzly HTTP connector. See Enabling Grizzly by Jean-Francois Arcand for more details. 58. How Do We Create A Thread To Do Ajax Polling? JavaScript does not have threads. JavaScript functions are called when an event happens in a page such as the page is loaded, a mouse click, or a form element gains focus. You can create a timer using the set Timeout which takes a function name and time in milliseconds as arguments. You can then loop by calling the same function as can be seen in the JavaScript example below. function checkForMessage() { // start AJAX interaction with processCallback as the callback function } // callback for the request function processCallback() { // do post processing setTimeout("checkForMessage()", 10000); } Notice that the checkForMessage will continue to loop indefinitely. You may want to vary the increment the interval based on activity in the page or your use cases. You may also choose to have logic that would break out of the loop based on some AJAX response processing condition. 59. Is The Xmlhttprequest Object Part Of A W3c Standard? No. Or not yet. It is part of the DOM Level 3 Load and Save Specification proposal. 60. How Does One Call A Javascript Function From The Ajax Code? Ajax is a form of JavaScript, which uses XML Http Request objects that take action event parameters into a method called âopenâ. The term AJAX symbolizes Asynchronous Java script and XML, wherein there is no order in which the requests and responses are tracked.âXMLHttpRequest.openâ takes action events as URL Parameters. On the other hand, âXMLHttp Request.sendâ sends the Request object either asynchronously or synchronously, depending on whether the option for the synchronous version is true or false. 61. Can You List Some Examples Of Ajax-based Applications? Some applications and scenarios in which AJAX is utilized include login forms, auto-complete (e,g. Google search ), voting and rating systems, updating with user content, form submission and validation, chat rooms and instant messaging, Slicker UIs, external widgets, light-boxes (as opposed to pop-ups), and Flash (e.g. Flash games). 62. Is Ajax A Browser-dependent Or A Browser-independent Script? AJAX is a browser-dependent technology. The Ajax engine runs on Firefox, Opera 8, Safari and later Mozilla builds, and the Microsoft ActiveX object. 63. What is asynchronous request in AJAX? In an asynchronous request, the page continues to work normally without blocking the user. It is the most preferred way of sending a request. 64. Does Load Runner Support Ajax Apps? Load Runner supports AJAX Apps. However, Ajax protocols in Load Runner are not as efficient as they are in HTTP. Yet, using HTTP to record AJAX web requires copious custom coding. AJAX protocols heavily depend on memory, and running more than 2GB of ram could cause the machine to freeze. 65. Describe The Process And Benefits Of Using The Always Visible Control Extender? The Always Visible Control Extender authorizes a control to be pinned to a particular location. For example, when a control has been permanently set to be present at the left corner of the page, the control will be so in the prescribed left and right co-ordinates. This placement will apply, whenever the page is resized or scrolled. 66. What Are Synchronous And Asynchronous Ajax Requests? During the initiation of synchronous requests, the script desists and awaits a reply from the server before proceeding; but during the initiation of asynchronous requests, the script sanctions the procession of the page and handles the reply. 67. How We Can Send More Values Through The Response Text? We can send text values with the concatenation of âIâ operator and by splitting with the pipe operator like âresponseText.split(â|â);â If done properly, we would receive an array of our text. Now, we can access it, or we can use JSQN to send multiple text values in a array format. 68. What Is The Predominant Distinction Between Javascript And J-query? JavaScript is a language, while j-query is merely a library written using JavaScript. This library is light-weight, cross-browser compatible, and simple. One can also assert that j-query is a plugin used to build function. 69. When Should We Use A Java Applet Instead Of Ajax? Many amazing things can be done with AJAX/DHTML, but there are limitations. AJAX and applets can be used together in the same UIs, with AJAX providing the basic structure and applets providing more advanced functionality. The java applet can communicate to JavaScript using the Live-Connect APIs. One should not ask: âshould we use AJAX or applets?â Instead, one should discover which technology best fits your needs. In summary, AJAX and applets need not be mutually exclusive. 70. What Is The Difference Between A Destructor And A Garbage Collector? A destructor is a special member function of a class called as soon as an object is de-allocated, while a garbage collector is either a program or an application that de-allocates the memory of a formerly unreachable object. 71. Do Ajax Applications Always Deliver A Better Experience Than That Delivered By A Traditional Web Application? AJAX gives interaction designers more flexibility. However, the more power we have, the more caution we must use in exercising it. We must be careful to use AJAX only to enhance the user experience of our applications. 72. How Do We Manage Concurrent Request? For managing concurrent request we can write a function or we can use Java Script closures. After code processing is finishes the call back function and the URL would pass as parameters, they are passed to the object (Ajax Interaction). These closures are good in the way that they insure the right callback function will be invoked and this will have a particular Ajax Interaction. 73. Which Are The Problems That Can Be Fixed Using Ajax And What Is The Actual Meaning Of Ajax? The technologies that represent Ajax belong to the client and they make possible an asynchronous client to server communication. When synchronous communication is involved at every event a complete round trip takes place, issue solved by using asynchronous communication. 74. Is There Any Use Abilities Problems In Ajax? The appearance of a page is changed very much when we used Ajax interaction to dynamically update it. Because of the dynamically changes, also the state of the page is modify and the page behavior has to be defined for the following actions :navigation, using back , slash forward, page bookmarks, URL sharing, time dependant , printing of pages. Navigation-we have to define page refreshing, back and forward and so on .For simplifying navigation we can use a Java Script framework like Dojo. For bookmarking or URL sharing we have Dojo. Printing-problems may appear when the rendered pages are printed dynamically. 75. Which Are The Knowledge Requirements For Personal Ajax Functionality? To make a personal Ajax component and not reuse an already made one we need to have knowledge of the following: Learning of DHTML or Dynamic HTML is a must because this is the Ajax foundation; it enables a high level of interaction in the browsers between users and pages. CSS, Document Object Model and Java Script form together what is called DHTML. We must also learn JavaScript which is an object based language compatible with the majority of browsers and very important for the interactions of Ajax, JavaScript is invoked on mouse clicks, page boots pr completing various form. Document Object Model or DOM is an application used for handling structured documents usually with HTML or XML documents. CSS-gives us the possibility to dyne the appearance(fonts, sizes, colors, positions it).In addition to these we must also known about the requestresponse behavior of HTTP, because ignoring some of the things involved can load to serious bugs. 76. Which Are The Trigger Types That We Find In Update Panel? The types or triggers are in member of two: PostBackTrigger and AsynPostBackTrigger. The first one makes a complete postback. It doesnât work asynchronously, the second one makes a practical postback and this is working asynchronously. 77. How Can Javascript Be Debugged? Right now the number of utilities that are compatible with both client and server debugging is small, but this could change over time. The debugging is currently made in separate way. Some of the client debuggers for some popular browsers are presented below: the Venkman debugger is a built-in feature of Netscape/Mozilla browser and also there is an add-on called FireBug, also the browser Safari has a similar debugger that can be used by activation and Internet Explorer has some methods of debugging JavaScript. A common method used by debuggers is âAlert Debuggingâ with the function âalert( )â. 78. What Are The Protocols And Forms In Ajax? XMLHttpRequest, this protocol is meant for doing requests to a server. The client browser makes an object, the transfer of data happens in JSON or plain text. The JSON format can be parsed by java script and will be compatible with every browser. 79. Do We Have To Use Http Get/post For The Ajax Calls? If the data doesnât change for a particular request URL, HTTP GET requests are necessary. If the state on a server is going to be updated then a HTTP POST is necessary. 80. Easy Trough That The Classical Web Applications Are Harder To Make Than Ajax Applications? Not really, because the code that has to run on the client is complicated and it is hard to create such a code, without having bugs and we need the aid of many tools of an efficient code. 81. Why Is Html_ajax Having Stability Issues On Some Installations? If the problem that we have with is specific to certain servers the best explanation would be that the problem relates to output compression. It can be dictated and fixed PHP config but if it is a related apache extension it is almost impossible to be detected properly. In most cases we will have to disable the AJAX extension, but in rare cases we can fix the issue by using the setting sendContentLength to false. Also xDdebug can create some issues but they can be fixed by the activating the extension. 82. Is It True That Ajax Is Code Browser Compatible? Yes but only partially. The majority of browsers give us a built-in XMLHttpRequest JavaScript object but some, like Internet Explorer, will asked it in the form of an ActiveX object. 83. Is It True That A Xmlhttprequest Objects Belongs To The W3c Standard? This hasnât been decided until now but we know just that it belongs to DOM Level 3 Load and Save. 84. What Meaning Has Asp.net Ajax? ASP .NET Ajax is developed by Microsoft and it represent the free Ajax frame work used for creating applications that have a great amount of interactivity and is compatible with all the browsers. It gives us the possibility to choose our own way of using Ajax no matter if is Server-side, Client-side, the Query library or the Ajax Control Tool kit. 85. What Are The Browser Versions That Ajax Is Compatible With? From the version 0.3.0 Ajax is compatible with Internet Explorer 5.5, Mozilla Firefox 1.0, Safari 2+ and Opera 8.5+. 86. In What Way Are Proxyless Calls Different Than The Proxied Calls In Ajax? Proxyless calls can be possible using functions such as HTML_AJAX.replace() or HTML_AJAX.append(). This functions are JavaScript utilities. Proxied calls are possible by using limitations of PHP classes or stub objects in JavaScript. 87. How Can We Make A Mashup With Java By Accessing Other Domains Data? We can gain access to other domains data in our Java Script clients if the format of the data returned is in JSON format. In this way JavaScript client can be made which is running with the usage of another servers data, method called JSQN with Padding (JSQNP). This method has his doubts when it comes to security, because it functions by bringing data from outside our domain, but the execution is made inside. Not every type of data from outside can be accessed as JSON and sometimes we want more security. In Java a proxy can be given to outside services with the aid of what we called a servlet, which is used for communication management between outside and inside services and gives us the possibility of changing the format of the data we provide according to our wishes. For speed improvement data can be cached. 88. Does Ajax Have The Same Meaning As Xmlhttprequest? Because XMLHttpRequest is just a piece of Ajax, the answer will be no. Ajax depends on many pieces like XMLHttpRequest, CSS, DOM, etc. XMLHttpRequest is the part responsible for asynchronous server communication. 89. In Ajax Does The Client Or The Sever Have The Control? Sometimes yes, sometimes no. It can be more like a server-side centralized component or controller or client-side controller. A centralized server-side controller is the case where we must assure that the client-side page data is synchronized with the server data. Many programs are preserving everything on the server and the updates are given to the client DOM through an easy Java Script controller. The case of client and server-side controllers uses a JavaScript for making each control that relates to presentation, each processing of events, each manipulation of pages and model data rendering on the client. The responsibility of business logic or giving the updated model data to a client is taken by the server-side. But this case doesnât include specific information about the initial pages which is sent to the request of the client page. In certain use cases the whole Ajax application is possible to write in one page. If we chose this we must also remember about bookmarking and navigation. 90. We Used Asynchronous Server Communication For A Long Time, What New Thing Is Ajax Bringing? Ajax is bringing changes in the way we use interactive real-world web applications. Now itâs time to apply all this new technologies that have been in development for many years. 91. Is It True That The Ajax Application Are Much Better Than The Classical Internet Applications? Not really. What it is true is that Ajax has brought more flexibility. This flexibility also implies a higher degree of responsibility when we use Ajax for providing a better experience for the user. 92. What Is The Response Time When Using Ajax? Response time can also be named latency and it means the period of time that passes from the beginning of a request processing by the client to the sever until its end. Id the time is longer than normal then we say we had a delay, Delays usually appear when the XMLHttpRequest object is badly handled. 93. Which Is The Purpose For Using The Scriptmanager? ScriptManager is used for handling every ASP.NET Ajax resource and it makes links for the client libraries in ASP.NET Ajax. This means we will be able to use UpdatePanels, PageMethods and others. Also the page request Manager and Application objects are made, they are important in the client life cycle for raising events in the ASP.NET Ajax web pages. It is also good for making proxies for calling web services asynchronously. 94. What Is The Use Of Updatepanel? Updatepanel gives us the possibility to make ASP .NET applications Ajax compatible, to update the content of a page with the aid of Partial-Page rendering. This is useful for refreshing a section of the page without refreshing the entire page. 95. What is the full form of AJAX? AJAX stands for Asynchronous JavaScript and XML. 96. How can you debug AJAX application? If you want to debug in Google Chrome, then use Chrome Developer Tool. On Mozilla Firefox, with the help of Firebug, debugging can be done easily. 97. Can you provide any real world example of AJAX? Nowadays, many websites and web applications are using AJAX. Some of the most popular web applications are- Google Maps Youtube Instagram Google Plus Twitter Facebook 98. What are disadvantages of AJAX? Every technology is not a perfect and has some disadvantages. The cons of AJAX are- Source code of AJAX is viewable. It depends on javascript and cannot work if javascript is disabled in a web browser. Malicious code can be inserted into the system. 99. What is Rich Internet Application (RIA)? An application that works similar to a desktop application and has enhanced the user interface, advanced functions and quicker response time. 100. What are the most popular AJAX framework? Angular JS Backbone.js Prototype Ext JS jQuery and jQuery UI AJAX Questions and Answers Pdf Download Read the full article
0 notes
Link
List of Top 20 Most Asked ASP.NET MVC Interview Questions like, What is Data Annotations in ASP.NET MVC, Scaffolding Techniques, Url Helpers, Razor View Engine, Difference Between Routing and URL Rewriting, Routing in ASP.NET MVC. When to use _ViewStart & Many More
0 notes